Recent Questions - Quantum Computing Stack Exchange most recent 30 from quantumcomputing.stackexchange.com 2020-12-02T09:54:11Z https://quantumcomputing.stackexchange.com/feeds https://creativecommons.org/licenses/by-sa/4.0/rdf https://quantumcomputing.stackexchange.com/q/14929 0 How close or far apart are the distributions generated by two Haar random states? BlackHat18 https://quantumcomputing.stackexchange.com/users/1351 2020-12-02T09:31:37Z 2020-12-02T09:31:37Z <p>Consider two <span class="math-container">$n$</span> qubit Haar-random quantum states <span class="math-container">$|\psi\rangle$</span> and <span class="math-container">$|\phi\rangle$</span>. Let <span class="math-container">$D_{|\psi\rangle}$</span> and <span class="math-container">$D_{|\phi\rangle}$</span> be the two probability distributions (over <span class="math-container">$n$</span>-bit strings) obtained by measuring <span class="math-container">$|\psi\rangle$</span> and <span class="math-container">$|\phi\rangle$</span> respectively, in the standard basis. I had two questions:</p> <ol> <li>What can we say about the total variation distance between <span class="math-container">$D_{|\psi\rangle}$</span> and <span class="math-container">$D_{|\phi\rangle}$</span> (with some probability over the choice of a particular <span class="math-container">$|\psi\rangle$</span> and <span class="math-container">$|\phi\rangle$</span>)?</li> <li>Are <span class="math-container">$D_{|\psi\rangle}$</span> and <span class="math-container">$D_{|\phi\rangle}$</span> computationally/statistically indistinguishable (again with some probability over the choice of a particular <span class="math-container">$|\psi\rangle$</span> and <span class="math-container">$|\phi\rangle$</span>)?</li> </ol> https://quantumcomputing.stackexchange.com/q/14927 1 Maximum number of qubits suppoted by the Qasm simulator L. Lenzini https://quantumcomputing.stackexchange.com/users/14007 2020-12-02T08:48:16Z 2020-12-02T09:31:53Z <p>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?</p> https://quantumcomputing.stackexchange.com/q/14926 0 Numerical optimization of QRAC Vaisakh M https://quantumcomputing.stackexchange.com/users/13591 2020-12-02T07:54:44Z 2020-12-02T07:54:44Z <p>I need to optimize a general version of 3<span class="math-container">$\rightarrow$</span>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<span class="math-container">$\oplus$</span>B, A<span class="math-container">$\oplus$</span>c, B<span class="math-container">$\oplus$</span>C, A<span class="math-container">$\oplus$</span>B<span class="math-container">$\oplus$</span>C). I know that build in optimization in Mathematica could be used for this kind of stuff, but I'm unsure how to proceed.</p> <p>Kindly ask if you have any confusion regarding my problem. Thanks</p> https://quantumcomputing.stackexchange.com/q/14925 1 Changing the sign of relative phase Veerano https://quantumcomputing.stackexchange.com/users/14005 2020-12-02T04:15:27Z 2020-12-02T09:31:48Z <p>Say I have a qubit in the state (ignoring normalization) <span class="math-container">$$|\phi\rangle = \alpha|0\rangle + e^{i\alpha}\beta|1\rangle.$$</span> How can I invert the sign of its phase, thus making it <span class="math-container">$$\alpha|0\rangle + e^{-i\alpha}\beta|1\rangle$$</span> using only the basic gates <span class="math-container">$\{X,Y,Z,H,S\}?$</span></p> https://quantumcomputing.stackexchange.com/q/14923 0 A CNOT between two Hadamard gates: why does the CNOT changed the output of the second Hadamard gate? Devymex https://quantumcomputing.stackexchange.com/users/13982 2020-12-01T20:26:19Z 2020-12-01T21:52:57Z <p>Applying the Hadamard gate twice in a row, it restores the original input: <a href="https://i.stack.imgur.com/wbRIF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wbRIF.png" alt="Two Hadamard gayes" /></a></p> <p><a href="https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B%22H%22%5D,%5B%22H%22%5D%5D%7D" rel="nofollow noreferrer">https://algassert.com/quirk#circuit={%22cols%22:[[%22H%22],[%22H%22]]}</a></p> <p>However, if a CNOT control is added between the two Hadamard gates, the output of the second Hadamard gate changes:</p> <p><a href="https://i.stack.imgur.com/ymUWQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ymUWQ.png" alt="A CxNOT gate" /></a></p> <p><a href="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" rel="nofollow noreferrer">https://algassert.com/quirk#circuit={%22cols%22:[[%22H%22],[%22%E2%80%A2%22,%22X%22],[%22Chance%22],[%22H%22]]}</a></p> <p>I can't understand the behavior of the second Hadamard gate: the input has remaining <span class="math-container">$\frac{|0\rangle+|1\rangle}{\sqrt{2}}$</span> and the gate does not seem to have any effect.</p> https://quantumcomputing.stackexchange.com/q/14920 0 What does it mean "the N uses of classical-quantum channel"? Najeeb Ullah https://quantumcomputing.stackexchange.com/users/13996 2020-12-01T12:37:40Z 2020-12-01T13:09:50Z <p>I was reading a paper &quot;Quantum Polar codes by M.M wilde&quot;, where he discusses the N uses of the channel in the classical-quantum channel setting. What does he mean by &quot;multiple channel uses&quot;?</p> https://quantumcomputing.stackexchange.com/q/14919 2 IBMQ: Can I implement a quantum measurement in the middle of a quantum circuit? dr.bian https://quantumcomputing.stackexchange.com/users/13997 2020-12-01T12:08:47Z 2020-12-02T03:06:37Z <p>I am executing a quantum circuit on an IBM quantum device. The circuit is simple:</p> <p>A single qubit (start from <span class="math-container">$|0\rangle$</span>),</p> <ol> <li>Rx(<span class="math-container">$\pi/2$</span>)</li> <li>Measure (in z) 3 .Rx(<span class="math-container">$-\pi/2$</span>)</li> <li>Measure (in z)</li> </ol> <p>The final measurement probabilities should be Prob:1/2, result:0; Prob:1/2, result:1.</p> <p>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?</p> https://quantumcomputing.stackexchange.com/q/14917 1 How to measure a quantum circuit's execution time on a real IBM device? Alfred https://quantumcomputing.stackexchange.com/users/13893 2020-12-01T11:06:07Z 2020-12-01T13:28:51Z <p>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:</p> <pre><code>result = job.result() execution_time = result.time_taken </code></pre> <p>but in this particular case what I need is more like a &quot;signal&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.</p> https://quantumcomputing.stackexchange.com/q/14914 0 RAC for XOR functions Vaisakh M https://quantumcomputing.stackexchange.com/users/13591 2020-12-01T06:56:40Z 2020-12-01T06:56:40Z <p>I need the optimal encoding protocol for 3 <span class="math-container">$\rightarrow$</span> 1 Classical RAC such that the receiver is able to retrieve any <strong>one</strong> of the initial bits, as well as the <em>XOR</em> combinations of those bits. ( If a, b, c are the bits in the string, then Bob would be asked to predict one of the <strong>seven</strong> possible functions, namely, a, b, c, a<span class="math-container">$\oplus$</span>b, b<span class="math-container">$\oplus$</span>c, a<span class="math-container">$\oplus$</span>c, a<span class="math-container">$\oplus$</span>b<span class="math-container">$\oplus$</span>c).</p> <p>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.</p> <p>But is this optimal? If so, how do I prove it?</p> https://quantumcomputing.stackexchange.com/q/14910 2 In shadow tomography, how is the state reconstructed from its shadows? glS https://quantumcomputing.stackexchange.com/users/55 2020-11-30T20:01:07Z 2020-12-02T08:57:22Z <p>I'm reading <a href="https://arxiv.org/abs/2002.08953" rel="nofollow noreferrer">Huang et al. (2020)</a> (<a href="https://www.nature.com/articles/s41567-020-0932-7" rel="nofollow noreferrer">nature physics</a>), where the authors present a version of Aaronson's <em>shadow tomography</em> scheme as follows (see page 11 in the arXiv version):</p> <p>We want to estimate a state <span class="math-container">$\rho$</span>. We apply a number of random unitary evolutions, <span class="math-container">$\rho\mapsto U\rho U^\dagger$</span>, picking <span class="math-container">$U$</span> from an ensemble <span class="math-container">$\mathcal U$</span>. For each choice of unitary <span class="math-container">$U$</span>, we perform a measurement, observing a state <span class="math-container">$|b\rangle$</span>. We then apply the inverse evolution to this state, obtaining <span class="math-container">$U^\dagger|b\rangle$</span>. On average, this procedure leaves us with the state <span class="math-container">$$\mathcal M(\rho) =\mathbb E_{U\sim\mathcal U}\Bigg[ \sum_b \underbrace{\langle b|U\rho U^\dagger|b\rangle}_{\text{prob of observing |b\rangle}} \!\!\!\!\!\!\! \overbrace{(U^\dagger |b\rangle\!\langle b|U)}^{\text{post-measurement state}} \Bigg].$$</span> The claim is then that <span class="math-container">$\mathcal M$</span> can be inverted to obtain, on average, the original state: <span class="math-container">$$\hat\rho=\mathcal M^{-1}(U^\dagger |\hat b\rangle\!\langle \hat b| U) \,\,\text{ is such that } \,\, \mathbb E[\hat \rho]=\rho.$$</span></p> <p>Is there an easy way to see how one would go in performing such inversion? The authors mention that we are thinking here of <span class="math-container">$\mathcal M$</span> as a linear map, so I suppose we represent <span class="math-container">$\rho$</span> 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 <span class="math-container">$\mathcal M(\sigma_i)$</span> for some complete basis of Hermitians <span class="math-container">$\{\sigma_i\}_i$</span>.</p> https://quantumcomputing.stackexchange.com/q/14906 3 Is there an efficient way to realize a Toffoli with control qubits fixed at $|+\rangle$? Daniele Cuomo https://quantumcomputing.stackexchange.com/users/8954 2020-11-30T12:21:54Z 2020-12-01T15:45:17Z <p>I wrote a circuit that makes use of Toffoli gates, but it is too inefficient for my purpose.</p> <p>In my circuit the states of control qubits are fixed to <span class="math-container">$|+\rangle$</span> state. So I wanted to know if there is an efficient way to realize a Toffoli for that fixed case.</p> https://quantumcomputing.stackexchange.com/q/14903 1 Question about a circuit from "Quantum Computing for Computer Scientists" LPenguin https://quantumcomputing.stackexchange.com/users/13987 2020-11-29T21:38:13Z 2020-11-30T14:08:26Z <p>I am trying to implement a basic quantum computing emulator. In the chapter on Grover's algorithm, we're shown the following circuit:</p> <p><a href="https://i.stack.imgur.com/CuN4s.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CuN4s.png" alt="enter image description here" /></a></p> <p>They demonstrate Grover's algorithm with a function <span class="math-container">$f$</span> that picks out <span class="math-container">$101$</span>, i.e. <span class="math-container">$f(101)=1$</span> and <span class="math-container">$0$</span> otherwise. They start with <span class="math-container">$\psi_{1}=[1, 0, 0, 0, 0, 0, 0, 0]^{T}$</span>. The Hadamard gate (specifically H tensored with itself <span class="math-container">$n$</span> times) gives <span class="math-container">$\psi_{2}=1/\sqrt8 [1, 1, 1, 1, 1, 1, 1, 1]^{T}$</span>. This is as far as I've come. They don't show explicitly how to get to <span class="math-container">$\psi_{3}$</span>, which should be <span class="math-container">$1/\sqrt8 [1, 1, 1, 1, 1, -1, 1, 1]^{T}$</span>. I am not sure how to interpret the circuit.</p> <p>My best guess was to take the tensor product of <span class="math-container">$|0 \rangle=|000 \rangle$</span> and <span class="math-container">$|1 \rangle = [0, 1]^{T}$</span>, then apply <span class="math-container">$I_{2^{n}} \otimes H$</span>, then <span class="math-container">$U_{f}$</span>. However, I have two problems:</p> <p>The book says that, at that stage in the calculation, <span class="math-container">$\psi_{3} = 1/\sqrt8 [1, 1, 1, 1, 1, -1, 1, 1]^{T}$</span>, which has length <span class="math-container">$8$</span>, instead of <span class="math-container">$16$</span>. I don't know how to &quot;extract&quot; the &quot;top&quot; qubits. Furthermore, my answer is <span class="math-container">$1/4[1, 1..., 1]^{T}$</span>, which doesn't suggest the correct answer (especially given the fact that every entry is <span class="math-container">$1/4$</span>).</p> <p>Am I misinterpreting this circuit? What is the correct way to go from <span class="math-container">$\psi_{2}$</span> to <span class="math-container">$\psi_{3}$</span>, from a programmatic point of view?</p> https://quantumcomputing.stackexchange.com/q/14898 4 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}$? narip https://quantumcomputing.stackexchange.com/users/13968 2020-11-29T13:13:01Z 2020-11-30T21:22:18Z <p>From Nielsen and Chuang's book: <span class="math-container">$\textit{Quantum computation and quantum information}$</span>, how can (5.34) equal (5.33)? I.e.</p> <p><span class="math-container">$$\dfrac{1}{2} \int_{e-1}^{2^{t-1}-1} dl \dfrac{1}{l^2} = \dfrac{1}{2(e-1)}.$$</span></p> https://quantumcomputing.stackexchange.com/q/14890 1 Inequality in overlap of quantum states Oli https://quantumcomputing.stackexchange.com/users/13973 2020-11-28T17:57:34Z 2020-11-30T11:12:01Z <p>For quantum states <span class="math-container">$\vert\psi_1\rangle, \vert\psi_2\rangle, \vert\phi\rangle$</span>, is it true that</p> <p><span class="math-container">$$\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$$</span></p> <p>My argument is that each number <span class="math-container">$c_i = \langle\phi\vert\psi_i\rangle$</span> is a complex number with modulus smaller than 1 since it is the square root of a probability. So we have to show</p> <p><span class="math-container">$$2|c_1|^2|c_2|^2 \leq c_1c_2^* + c_1^*c_2\tag{2}$$</span></p> https://quantumcomputing.stackexchange.com/q/14888 4 How do we realise photonic gates? Spock https://quantumcomputing.stackexchange.com/users/13972 2020-11-28T16:41:57Z 2020-11-30T11:12:53Z <p>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.</p> https://quantumcomputing.stackexchange.com/q/14887 3 Does 1 qubit correspond to 2 bits? malloc https://quantumcomputing.stackexchange.com/users/9285 2020-11-28T15:48:51Z 2020-11-30T14:33:15Z <p>In a lot of presentation I always see people say that <span class="math-container">$n$</span> qbit are approximately <span class="math-container">$2^n$</span> classical bit. Those talks where oriented for a broad audience, so they left out a lot of things. Deep down I felt that this couldn't be possible, but I didn't know anythings about qc so maybe this was the problem.</p> <p>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 <span class="math-container">$n$</span> qbit equal <span class="math-container">$2^n$</span> classical bits.(If it's not this let me know)</p> <p>I've understood what the topic is about, but I still think that the association <span class="math-container">$n$</span> qbit equal <span class="math-container">$2^n$</span> classical bits is <strong>wrong</strong> or at least misleading.</p> <p>Sending 2 bit to Bob, will require Alice to have 1 qbit and 1 entangled qbit where the other part of the eqbit is owned by Bob. Just by reading this is clear that <strong>2 bit actually correspond to 1 qbit + 1eqbit</strong>, but reading online one common approach to say that 1qbit=2bit is by introducing a third part that is responsible to send and eqbit to Alice and Bob. Isn't this a flawed way to think? When someone say <span class="math-container">$n$</span> qbit equal <span class="math-container">$2^n$</span> bit, they are implicitly stating that there is a way to encode the information of <span class="math-container">$2^n$</span> bits in <span class="math-container">$n$</span> qbit, but if you actually study the theory is not like this.</p> <p>Also saying that <strong>1qbit +1eqbit =2 bit</strong>, is not too much different than saying <strong>1qbit+1qbit=2qbit=2bit</strong>, because at the end of the day 1eqbit is just a qbit in a particular state. I know that differentiating between them is important since they are two different things, but physically we can see them as two object (two photons for example) that are in a different position, still they 'occupy the space of two object'. I also know that approximating 1 eqbit with 1 qbit is a strong affirmation, but stating that 1qbit = 2bit is stronger imo.</p> <p><strong>Is my way of thinking flawed? Why and where?</strong></p> <p>Also there is another thing that I couldn't understand on my own. In the textbook that I'm using (Quantum Computation and Quantum Information) one thing that they say is:</p> <blockquote> <p>Suppose Alice and Bob initially share a pair of qubits in the entangled state..</p> </blockquote> <p>Since the sharing of the eqbit and the sending of the qbit seems to happen in two different temporal window, they are able to store qbit? In essence I don't understand the temporal window of the algorithm. I understand how it works, but not when. <strong>Can you clarify this?</strong></p> <p>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.</p> https://quantumcomputing.stackexchange.com/q/14885 2 In Uhlmann's theorem, should the polar decomposition be written as $A=|A|V$ or $A=V|A|$? narip https://quantumcomputing.stackexchange.com/users/13968 2020-11-28T13:34:26Z 2020-11-30T11:17:46Z <p>In the proof of Uhlmann's theorem, the book writes the polar decomposition: <span class="math-container">$A = |A|V$</span>, with <span class="math-container">$|A| = \sqrt{A^\dagger A}$</span>.</p> <p>Shouldn't it be <span class="math-container">$V|A|$</span> instead? The former case is <span class="math-container">$A^\dagger A = V^\dagger|A||A|V$</span> while the latter case is <span class="math-container">$A^\dagger A = |A|V^\dagger V|A| = |A||A| = A^\dagger A$</span>.</p> https://quantumcomputing.stackexchange.com/q/14883 3 IBMQ backends: How can I know the repetition rate and depth limits of real devices? Lolo Soto https://quantumcomputing.stackexchange.com/users/13967 2020-11-28T10:48:17Z 2020-11-30T11:20:26Z <p>When trying to execute complex quantum circuits on IBMQ real devices, one can encounter a typical error (<code>ERROR_RUNNING_JOB</code>) with the message <code>'Circuit runtime is greater than the device repetition rate '.</code></p> <p>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).</p> <p>What's more, how can I calculate the circuit runtime depending on its depth (and I suppose types and number of gates being required)?</p> <p>For example, someone <a href="https://quantumcomputing.stackexchange.com/questions/11647/error-while-running-the-circuit-on-a-real-device-on-ibmq">asked 7 months ago</a> how to fix the 8020 error, which is &quot;simply&quot; fixed by reducing the circuit size, but at which point does someone have to reduce it depending on the real device (like <code>ibmq_16_melbourne</code> or <code>ibmq_manhattan</code>)?</p> https://quantumcomputing.stackexchange.com/q/14878 3 How are the eigenvalues of $\rho=\frac12(|a\rangle\!\langle a| +|b\rangle\!\langle b|)$ derived? Hasan Iqbal https://quantumcomputing.stackexchange.com/users/2403 2020-11-28T03:04:56Z 2020-11-30T11:21:39Z <p>Let's say I have a density matrix of the following form:</p> <p><span class="math-container">$$\rho := \frac{1}{2} (|a \rangle \langle a| + |b \rangle \langle b|),$$</span> where <span class="math-container">$|a\rangle$</span> and <span class="math-container">$|b\rangle$</span> are quantum states. I saw that the eigenvalues of this matrix are: <span class="math-container">$$\frac{1}{2} \pm \frac{|\langle a | b \rangle|}{2}.$$</span> I was just wondering how this was derived. It seems logical, i.e if <span class="math-container">$|\langle a | b \rangle| = 1$</span> then the eigenvalues are <span class="math-container">$0$</span> and <span class="math-container">$1$</span>, otherwise if <span class="math-container">$|\langle a | b \rangle| = 0$</span> then they are half and half. This means that the entropy of the system would either be <span class="math-container">$0$</span> or <span class="math-container">$1$</span>. But I was just wondering how to calculate the eigenvlaue from <span class="math-container">$\rho$</span>. Thanks!</p> https://quantumcomputing.stackexchange.com/q/14870 0 IBMQ: "Credentials are already in use" Delaram Nematollahi https://quantumcomputing.stackexchange.com/users/13698 2020-11-27T19:15:32Z 2020-11-30T11:55:22Z <p>Executing the following:</p> <pre><code>import numpy as np from qiskit import IBMQ, QuantumCircuit, Aer, execute from qiskit.quantum_info import Operator from qiskit.providers.ibmq import least_busy from qiskit.visualization import plot_histogram from qiskit.tools.jupyter import * provider = IBMQ.load_account() </code></pre> <p>I get the following error which I do not know what to do about, does anybosy know what I can do?</p> <pre><code>ibmqfactory.load_account:WARNING:2020-11-27 13:08:45,170: Credentials are already in use. The existing account in the session will be replaced. </code></pre> https://quantumcomputing.stackexchange.com/q/14867 0 Creating a parameterized Operator in Qiskit Paco Bontenbal https://quantumcomputing.stackexchange.com/users/13960 2020-11-27T14:44:38Z 2020-11-30T20:37:52Z <p>I'm trying to run a VQE for a specific custom Anzats. The Anzats is built up of an unitary matrix <span class="math-container">$U_H$</span>, which I'm trying to created in this way:</p> <pre><code>from qiskit import * from qiskit.circuit import Parameter from qiskit.quantum_info import Operator import math as m u_circuit = QuantumCircuit(2) # This does not work theta = Parameter('θ') U_H = Operator([ [m.cos(2 * theta) - 1j * m.sin(2 * theta), 0, 0, 0], [0, m.cos(2 * theta), -1j * m.sin(2 * theta), 0], [0, -1j * m.sin(2 * theta), m.cos(2 * theta), 0], [0, 0, 0, m.cos(2 * theta) - 1j * m.sin(2 * theta)] ]) u_circuit.unitary(U_H, [0, 1], label='U_H(θ)') U_H_gate = u_circuit.to_gate(label='U_H(θ)') </code></pre> <p>However, for the VQE to work, the circuit needs to be parameterized, and because of that, so does the unitary gate <code>U_H</code>. 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 <code>theta</code> so that it only exists between <span class="math-container">$0$</span> and <span class="math-container">$2\pi$</span>. Whenever I try to build a circuit using this function to generate the gates in the Ansatz, I get the following error:</p> <pre><code>ParameterExpression with unbound parameters ({Parameter(θ)}) cannot be cast to a float. </code></pre> <p>Does anyone know how I can create a parameterized circuit consisting of parameterized gates of the form described by the matrix the <code>U_H</code> operator, where <code>theta</code> ranges from <span class="math-container">$0$</span> to <span class="math-container">$2\pi$</span>?</p> https://quantumcomputing.stackexchange.com/q/14865 1 Getting Choi-matrix of a subsystem Daniele Cuomo https://quantumcomputing.stackexchange.com/users/8954 2020-11-27T12:08:03Z 2020-11-30T11:55:06Z <p>In Qiskit, for a given <code>QuantumCircuit</code> object, you can computed its Choi-matrix via the corresponding <code>Choi</code> object, for example:</p> <pre><code>myCircuit = QuantumCircuit(q1,q2) myChoi = Choi(myCircuit) </code></pre> <p>My problem is, that code gives the Choi-matrix describing the whole system, but I'm interested to one subsystem, say the one associate to q1. What can I do?</p> <p>I would like to do something like</p> <pre><code>myChoi = Choi(myCircuit, q1) </code></pre> https://quantumcomputing.stackexchange.com/q/14856 2 Creating a resource count unit test in Q# Craig Gidney https://quantumcomputing.stackexchange.com/users/119 2020-11-27T00:08:49Z 2020-11-30T11:53:57Z <p>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?</p> <p>For example, what changes do I have to make to the code below?</p> <pre><code>namespace Tests { open Microsoft.Quantum.Diagnostics; open Microsoft.Quantum.Intrinsic; operation op() : Unit { using (qs = Qubit) { for (k in 0..10) { CCNOT(qs, qs, qs); } } } @Test(&quot;ResourcesEstimator&quot;) operation test_op_toffoli_count_at_most_10() : Unit { ...? op(); ...? if (tof_count &gt; 10) { fail &quot;Too many Toffolis&quot;; } } } <span class="math-container">`</span> </code></pre> https://quantumcomputing.stackexchange.com/q/14855 0 Correctly configuring a Q# test project in Visual Studio Code Craig Gidney https://quantumcomputing.stackexchange.com/users/119 2020-11-27T00:03:16Z 2020-11-30T11:53:39Z <p>I have some Q# code which I'm editing using visual studio code. The codebase is divided into a <code>src/</code> folder and a <code>test/</code> 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 <code>src/</code> folder is invalid.</p> <p>For example, in this screen shot you can see red underlines as if there are errors, but actually the project builds and runs fine:</p> <blockquote> <p><a href="https://i.stack.imgur.com/DExCK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DExCK.png" alt="sample" /></a></p> </blockquote> <p>This is quite annoying, and I can't figure out what about my setup is causing it.</p> <p>Here is <code>src/example.qs</code>:</p> <pre><code>namespace Example { open Microsoft.Quantum.Intrinsic; @EntryPoint() operation main() : Unit { Message(&quot;main&quot;); } operation op() : Int { return 42; } } </code></pre> <p>Here is <code>test/test.qs</code>:</p> <pre><code>namespace Example.Tests { open Example; open Microsoft.Quantum.Diagnostics; @Test(&quot;ToffoliSimulator&quot;) operation test_op() : Unit { if (op() != 42) { fail &quot;wrong result&quot;; } } } </code></pre> <p>Here is <code>src/src_project.csproj</code>:</p> <pre><code>&lt;Project Sdk=&quot;Microsoft.Quantum.Sdk/0.13.20111004&quot;&gt; &lt;PropertyGroup&gt; &lt;OutputType&gt;Exe&lt;/OutputType&gt; &lt;TargetFramework&gt;netcoreapp3.1&lt;/TargetFramework&gt; &lt;/PropertyGroup&gt; &lt;/Project&gt; </code></pre> <p>Here is <code>test/test_project.cs_proj</code>:</p> <pre><code>&lt;Project Sdk=&quot;Microsoft.Quantum.Sdk/0.13.20111004&quot;&gt; &lt;PropertyGroup&gt; &lt;TargetFramework&gt;netcoreapp3.1&lt;/TargetFramework&gt; &lt;IsPackable&gt;false&lt;/IsPackable&gt; &lt;/PropertyGroup&gt; &lt;ItemGroup&gt; &lt;PackageReference Include=&quot;Microsoft.Quantum.Xunit&quot; Version=&quot;0.13.20111004&quot; /&gt; &lt;PackageReference Include=&quot;Microsoft.NET.Test.Sdk&quot; Version=&quot;16.4.0&quot; /&gt; &lt;PackageReference Include=&quot;xunit&quot; Version=&quot;2.4.1&quot; /&gt; &lt;PackageReference Include=&quot;xunit.runner.visualstudio&quot; Version=&quot;2.4.1&quot; /&gt; &lt;DotNetCliToolReference Include=&quot;dotnet-xunit&quot; Version=&quot;2.3.1&quot; /&gt; &lt;ProjectReference Include=&quot;..\src\src_project.csproj&quot; /&gt; &lt;/ItemGroup&gt; &lt;/Project&gt; </code></pre> <p>Here is <code>.vscode/tasks.json</code>:</p> <pre><code>{ &quot;version&quot;: &quot;2.0.0&quot;, &quot;tasks&quot;: [ { &quot;label&quot;: &quot;run tests&quot;, &quot;command&quot;: &quot;dotnet&quot;, &quot;type&quot;: &quot;process&quot;, &quot;args&quot;: [ &quot;test&quot;, &quot;${workspaceFolder}/test/test_project.csproj&quot;, ], &quot;group&quot;: { &quot;kind&quot;: &quot;test&quot;, &quot;isDefault&quot;: true } }, ] } </code></pre> <p>And finally here is <code>.vscode/launch.json</code>:</p> <pre><code>{ &quot;version&quot;: &quot;0.2.0&quot;, &quot;configurations&quot;: [ { &quot;name&quot;: &quot;debug&quot;, &quot;program&quot;: &quot;dotnet&quot;, &quot;type&quot;: &quot;coreclr&quot;, &quot;args&quot;: [ &quot;run&quot;, &quot;--project&quot;, &quot;${workspaceFolder}/src/src_project.csproj&quot;, &quot;-s&quot;, &quot;ToffoliSimulator&quot;, ], &quot;request&quot;:&quot;launch&quot;, &quot;logging&quot;: { &quot;moduleLoad&quot;: false }, }, ] } </code></pre> https://quantumcomputing.stackexchange.com/q/14851 2 How to generate all stabilizer states numerically? Ver https://quantumcomputing.stackexchange.com/users/13952 2020-11-26T14:21:56Z 2020-11-30T12:19:37Z <p>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?</p> https://quantumcomputing.stackexchange.com/q/14850 0 Quantum Circuit to inverse the probability distribution Saptarshi Sahoo https://quantumcomputing.stackexchange.com/users/12154 2020-11-26T12:57:28Z 2020-11-30T11:53:14Z <p>I'm using Qiskit and after running the circuit, as we all know, we get a count dictionary such as</p> <pre><code>{'0000': 66, '0001': 71, '0010': 68, '0011': 70, '0100': 77, '0101': 64, '0110': 64, '0111': 51, '1000': 52, '1001': 67, '1010': 43, '1011': 64, '1100': 61, '1101': 59, '1110': 73, '1111': 74} </code></pre> <p>Here the minimum count is <code>1010:43</code>. I want the same output just reversed <code>[1024-(count)]</code>. 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?</p> https://quantumcomputing.stackexchange.com/q/13361 1 How to implement gate error mitigation in Qiskit? Camilo160 https://quantumcomputing.stackexchange.com/users/10455 2020-08-17T03:35:17Z 2020-12-01T03:34:39Z <p>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.</p> https://quantumcomputing.stackexchange.com/q/13347 7 Consequences of $MIP^\ast=RE$ Regarding Quantum Algorithms Jonathan Trousdale https://quantumcomputing.stackexchange.com/users/8623 2020-08-16T16:30:01Z 2020-11-30T21:02:04Z <p>The (pending-peer review) proof of <span class="math-container">$MIP^\ast=RE$</span> in <a href="https://arxiv.org/abs/2001.04383" rel="nofollow noreferrer">this pre-print</a> has been hailed as a significant breakthrough. The significance of this result is addressed by Henry Yuen (one of the authors) in <a href="https://quantumfrontiers.com/2020/03/01/the-shape-of-mip-re/" rel="nofollow noreferrer">this blog post</a>. Scott Aaronson also lists some of the major implications in <a href="https://www.scottaaronson.com/blog/?p=4512" rel="nofollow noreferrer">this blog post</a>.</p> <p>For a non-local game (<span class="math-container">$G$</span>), define the supremum of success probabilities for non-relativistic tensor product strategies as <span class="math-container">$\omega^\ast(G)$</span>, and the supremum of success probabilities for a relativistic commuting operator (QFT) strategy as <span class="math-container">$\omega^{co}(G)$</span>. 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, <span class="math-container">$\omega^\ast(G) \le \omega^{co}(G)$</span>.</p> <p>My understanding of Yuen's post is that one consequence of <span class="math-container">$MIP^\ast=RE$</span> is that non-local games exist for which <span class="math-container">$\omega^\ast(G) &lt; \omega^{co}(G)$</span>. Specifically, he says</p> <blockquote> <p>There must be a game <span class="math-container">$G$</span>, then, for which the quantum value is different from the commuting operator value. But this implies Tsirelson’s problem has a negative answer, and therefore Connes’ embedding conjecture is false.</p> </blockquote> <p>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).</p> <p>The first part of my question is, <em>assuming this proof stands</em>:</p> <ul> <li>Does <span class="math-container">$MIP^\ast=RE$</span> 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)?</li> </ul> <p>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 <span class="math-container">$\omega^\ast(G) &lt; 0.5$</span> and <span class="math-container">$\omega^{co}(G) &gt; 0.5$</span>? Specifically, the second part of my question is:</p> <ul> <li>Does <span class="math-container">$MIP^\ast=RE$</span> 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?</li> </ul> <p><strong>EDIT:</strong> Henry Yuen has created an <a href="http://mipstar.henryyuen.net/doku.php" rel="nofollow noreferrer">MIP* Wiki</a> for those interested in better understanding this complexity class or the <span class="math-container">$MIP^\ast = RE$</span> result.</p> https://quantumcomputing.stackexchange.com/q/12611 2 STO-3G Basis Set Sagi56789 https://quantumcomputing.stackexchange.com/users/12460 2020-06-22T19:29:44Z 2020-12-01T01:00:57Z <p>Can someone please explain why STO-3G is considered to be a good basis set for quantum computing, while it does not help in classical computing? I would also be very grateful for any references to read about as I could not find the needed information.</p> https://quantumcomputing.stackexchange.com/q/4706 5 In Bell nonlocality, why does $P(ab|xy)\neq P(a|x)P(b|y)$ mean the variables are not statistically independent? ahelwer https://quantumcomputing.stackexchange.com/users/4153 2018-11-14T06:44:34Z 2020-12-01T11:36:31Z <p>I've been working through the paper <a href="https://arxiv.org/abs/1303.2849" rel="nofollow noreferrer"><em>Bell nonlocality</em></a> by Brunner et al. after seeing it in user glS' answer <a href="https://quantumcomputing.stackexchange.com/a/4690/4153">here</a>. Early on in the paper, the standard Bell experimental setup is defined:</p> <p><a href="https://i.stack.imgur.com/VUVqD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VUVqD.png" alt="Bell experiment"></a></p> <p>Where <span class="math-container">$x, y \in \{0,1\}$</span>, <span class="math-container">$a, b \in \{-1, 1\}$</span>, and the two people (Alice &amp; Bob) measure a shared quantum system generated by <span class="math-container">$S$</span> according to their indepedent inputs <span class="math-container">$x$</span> and <span class="math-container">$y$</span>, outputting the results as <span class="math-container">$a$</span> and <span class="math-container">$b$</span>.</p> <p>The paper then has the following equation:</p> <p><span class="math-container">$P(ab|xy) \ne P(a|x)P(b|y)$</span></p> <p>And claims the fact this is an <em>inequality</em> means the two sides are <em>not</em> statistically independent. It's been a long time since I took probability &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.</p>