diff --git "a/stack_exchange/QC/QCQ&A 2020.csv" "b/stack_exchange/QC/QCQ&A 2020.csv" new file mode 100644--- /dev/null +++ "b/stack_exchange/QC/QCQ&A 2020.csv" @@ -0,0 +1,62450 @@ +Id,PostTypeId,AcceptedAnswerId,ParentId,CreationDate,DeletionDate,Score,ViewCount,Body,OwnerUserId,OwnerDisplayName,LastEditorUserId,LastEditorDisplayName,LastEditDate,LastActivityDate,Title,Tags,AnswerCount,CommentCount,FavoriteCount,ClosedDate,CommunityOwnedDate,ContentLicense +10001,2,,2151,2/26/2020 15:51,,4,,"
A lot of focus in quantum machine learning in the near term revolves around variational quantum algorithms (you'll also see them called variational quantum circuits or parameterized quantum circuits), as well as their extensions to hybrid classical-quantum models. Though the field is evolving pretty fast, this recent review article gives a fairly good overview:
+ +Benedetti et al (2019). Parameterized quantum circuits as machine learning models
+ +I would certainly recommend it over the Nature paper mentioned above if you are intereted in the emerging near-term viewpoint.
+ +We've also been curating a number of explanatory QML materials and code demos over at pennylane.ai/qml which might be helpful for people trying to learn the field.
+",10193,,,,,2/26/2020 15:51,,,,0,,,,CC BY-SA 4.0 +10002,2,,9992,2/26/2020 15:53,,0,,"I don't know about quantum gates but here is a link to some ressources of a company which produces randomness using light noise (should be the same principle), you can maybe find something looking at some technical data or white papers here
+",8746,,,,,2/26/2020 15:53,,,,0,,,,CC BY-SA 4.0 +10003,2,,9997,2/26/2020 16:05,,2,,"This video does a good job of explaining quantum computing using a coin analogy. Also, I know they are older than a baby, but books such as Quantum Computing for Babies do a good job of simplifying the concepts so that anyone can understand them!
+",5955,,,,,2/26/2020 16:05,,,,0,,,,CC BY-SA 4.0 +10004,2,,9999,2/26/2020 16:06,,5,,"The normal interpretation of the controlled-not is certainly only relevant to the standard basis. In fact, if you choose a different basis, such as the $|\pm\rangle$ basis, then the role is entirely reversed, due to the circuit identity
+
So, you might complain that the name is not fair if it only applies to one particular basis. But you have to give it some name to distinguish it from the other gates, and calling it the same as you would call it in classical computation is more than reasonable.
+ +Yes, as you say, it is a permutation matrix (I guess this is what you mean by 'swap') but that hardly distinguishes it from many other permutation matrices.
+ +By the same token, consider the single-qubit $X$ matrix. Also called the bit-flip. In the computational basis, it flips bit values. But in a different basis, such as the Hadamard basis, it doesn't.
+ +I should also mention that I don't think your calculation of your circuit is correct. If you start with the collection $\{|00\rangle,|01\rangle,|10\rangle,|11\rangle\}$, the controlled-Hadamard maps these to $\{|00\rangle,|01\rangle,|1+\rangle,|1-\rangle\}$, and the swap then maps them to $\{|00\rangle,|10\rangle,|+1\rangle,|-1\rangle\}$, which is not what you stated. When you apply the controlled-not on these, some of them (the latter two) will be entangled.
+ +Let me run through one specific example: cNOT applied to $|+1\rangle$. The way that I work this out is the expand it as $(|0\rangle+|1\rangle)|1\rangle/\sqrt{2}$. I apply the controlled-not by using linearity and thinking about exactly the description of how it works on basis states: $|01\rangle\mapsto|01\rangle$ and $|11\rangle\mapsto|10\rangle$, so the output is $(|01\rangle+|10\rangle)/\sqrt{2}$.
+",1837,,,,,2/26/2020 16:06,,,,7,,,,CC BY-SA 4.0 +10006,1,10008,,2/26/2020 17:51,,2,134,"I would like to know how to know in which state a qubit is (I am talking about single-qubit errors), because in order to apply a non unitary gate in the simulator I have to renormalize the state or the corresponding non unitary Kraus operator (the non unitary gate in my circuit). Therefore I need to know in which state the circuit it. I am of course talking about the simulator, which in fact is classical and therefore it must be a way to know the state at each point of the circuit.
+",9887,,55,,10/28/2020 9:24,10/28/2020 9:24,How do I know in which state the qubit is in each step of the circuit for the simulator in qiskit?,I don't know why this doesn't work with Matrix
, but a fix for this would be to use ImmutableMatrix
instead
from sympy import Symbol, sin, cos, I, ImmutableMatrix
+from sympy.physics.quantum import qapply
+from sympy.physics.quantum.qubit import Qubit
+from sympy.physics.quantum.gate import UGate
+
+theta = Symbol('theta')
+
+Ry_mat = ImmutableMatrix([[cos(theta/2), -sin(theta/2)],
+ [sin(theta/2),cos(theta/2)]])
+Rx_mat = ImmutableMatrix([[cos(theta/2), -I*sin(theta/2)],
+ [-I*sin(theta/2) ,cos(theta/2)]])
+
+Ry = UGate((0,), Ry_mat)
+Rx= UGate((1,), Rx_mat)
+c = Ry* Ry
+
+print(qapply(c*Qubit('00'))) # -sin(theta/2)**2*|00> + 2*sin(theta/2)*cos(theta/2)*|01> + cos(theta/2)**2*|00>
+
+
+
+I've filed an issue for your problem. In the meantime, use ImmutableMatrix
.
You can take snapshots of the statevector of the circuit when you use the 'qasm_simulator'
. You simply append snapshot instructions into your circuit where you would like to see the statevector, and then can see the values in the result object that is returned. You add a snapshot instruction using
from qiskit.extensions.simulator import snapshot
+qc.snapshot('my_label')
+
+",5955,,,,,2/26/2020 18:03,,,,3,,,,CC BY-SA 4.0
+10009,1,10010,,2/26/2020 18:36,,5,487,"I am trying to understand Deutsch-Jozsa algorithm. It is mentioned as the first algorithm to demonstrate exponentially faster performance compared to classical algorithms for the same problem.
+ +What I find missing in most explanations is why the quantum algorithm can be analyzed using the same complexity analysis as that of classical algorithms. It doesn't seem like an apple to apple comparison to me.
+ +More concretely:
+ 1. Classical solutions require at-least $2^{n-1}+1$ evaluations of the black-box function where $n$ is the number of classical bits.
+ 2. Deutsch-Jozsa algorithm requires a single evaluation of the black-box function. However, it takes as input $n$ qubits.
Considering we've changed the input as well as the function, how can we compare these two solutions and make the claim that one is exponentially faster than the other?
+",10147,,,,,2/27/2020 10:29,How can we compare quantum algorithms against classical equivalents?,Scott Aarsonson answers your question. There is a difference between the relativized world where the models of computation we are studying have access to oracles and the unrelativized one where there are no oracles. When we claim that ""One is exponentially faster than the other"" in the Deutsch-Jozsa sense, we are saying that ""One is exponentially faster than the other relative to an oracle"".
+",362,,,,,2/26/2020 22:49,,,,2,,,,CC BY-SA 4.0 +10011,2,,10009,2/26/2020 23:15,,1,,"Computational complexity is a concept used to analyze algorithms independently from the physical resources used to implement them. In computational complexity, we generally consider a number of input $n$ and we express the complexity by a function of the number of input $f(n)$, characterizing the resources needed for the computation, typically, time or space.
+ +In quantum computing the inputs are qubits, and so complexity of an algorithm is a function of $n$, If we have $n$ qubits in input. The nature of the input does not influence the complexity of the algorithm. It is true that simulation of quantum computers has an exponential complexity for time and space resources on a classical computer but analysis of quantum algorithms are supposing the existence of an actual quantum computer.
+ +Taking the case of the Deutsch-Jozsa algorithm, for $n$ qubits in input, we need $\mathcal{O(n)}$ gates, $\mathcal{O(n)}$ measurement as well and the application of an oracle, which I think also has $\mathcal{O(n)}$ complexity in time but that would ask for confirmation. Globally, we need $\mathcal{O(n)}$ operations. In the case of a classical computer we need $\mathcal{O}(2^n)$ operations so you can see that there's an exponential speedup for the quantum computer.
+ +Of course complexity is concerned with the asymptotic behavior in the increasing number of inputs and a classical computer can perform better if we take practical consideration into accounts such as constant time needed for operations on small number of inputs, or the actual long time of preparation needed for qubits.
+ +Another consideration for treating complexity in quantum computers is the need for additional qubits for error correcting codes. While it shouldn't influence the complexity in time it does influence the resources needed in space.
+ +This wikipedia article mentions that the Shor's algorithm without correcting codes requires between $L$ and $L^2$ qubits for factoring a number with $L$ bits, but requires to multiply by another factor $L$ the number of qubits needed with quantum error correcting codes.
+",10065,,10065,,2/27/2020 10:29,2/27/2020 10:29,,,,3,,,,CC BY-SA 4.0 +10012,1,,,2/27/2020 1:39,,3,207,"I want to know the fidelity (or error rate) of the preparation of $|0\rangle$. How can I obtain it?
+",10200,,55,,6/24/2021 22:29,6/24/2021 22:29,How can I find the fidelity of the preparation operation $|0\rangle$ of IBMQ?,You can play with the circuit's data
. First write:
print(circ.data)
+
+
+or
+ +from pprint import pprint
+pprint(vars(circ.data))
+
+
+Then you'll understand the structure and how to modify it.
+",7659,,,,,2/27/2020 6:46,,,,4,,,,CC BY-SA 4.0 +10014,1,10015,,2/27/2020 9:47,,5,466,"It is well known that circuit
+ + + +can be replaced with this circuit
+ + + +The situation is even easier in case of controlled $\mathrm{Z}$ where gate controlled by $q_0$ and acting on $q_1$ have same matrix as one controlled by $q_1$ and acting on $q_0$. This means that replacing gate controled by qubit ""below"" with one controlled by qubit ""above"" does not need any additional gate.
+ +I was thinking about general case, i.e. how to replace general controlled gate $\mathrm{U}$ with controlling qubit ""below"" by the gate controlled by qubit ""above"". The very basic idea is to apply swap gate, then controlled $\mathrm{U}$ with controlling qubit ""above"" and then again swap gate. This is right approach because $\mathrm{U}$ gate controlled by qubit ""above"" is described by matrix
+ +$$ +\mathrm{CU_{above} =} +\begin{pmatrix} +1 & 0 & 0 & 0 \\ +0 & 1 & 0 & 0 \\ +0 & 0 & u_{11} & u_{12} \\ +0 & 0 & u_{21} & u_{22} +\end{pmatrix} +$$
+ +and the gate controlled by qubit ""below"" has this matrix
+ +$$ +\mathrm{CU_{below} =} +\begin{pmatrix} +1 & 0 & 0 & 0 \\ +0 & u_{11} & 0 & u_{12} \\ +0 & 0 & 1 & 0 \\ +0 & u_{21} & 0 & u_{22} +\end{pmatrix}. +$$
+ +It can be easily checked that $\mathrm{CU_{bellow}} = \mathrm{SWAP} \cdot \mathrm{CU_{above}} \cdot \mathrm{SWAP}$.
+ +Swap gate can be implemented with three $\mathrm{CNOT}$, two controlled by qubit ""above"", one controlled by qubit ""below"". However, the latter can be converted to $\mathrm{CNOT}$ controlled by qubit ""above"" with help of Hadamards. Ultimatelly, all $\mathrm{CNOT}$s in swap gate are controlled by qubit ""above"".
+ +So, this is a desired general approach how to convert a gate controlled by qubit ""below"" to one controlled by qubit ""above"". However, application of two swap gates increases depth of the circuit.
+ +My question are these:
+ +Any controlled-$U$ where $U^2=I$ is straightforward. This is because you can write $U=VZV^\dagger$. So, we can think of controlled-$U$ as $V^\dagger$ on target, then controlled-phase, then $V$ on target.
+ +Given the symmetry of controlled-phase, all you have to do is switch which qubits the single-qubit unitaries are applied to.
+
+This clearly contains your two stated cases ($U=X,Z$) as special cases ($V=H,I$).
About the case of more general $U$, I've never thought about it... My first instinct is that given any controlled-$U$ can be decomposed in terms of two controlled-nots and three single-qubit gates, and it seems most likely that it would take that to reverse the action, you'd be better off just directly implementing controlled-$U$ with the switched control/target assignment, and ignoring the fact that you already have controlled-$U$ in the other direction!
+",1837,,1837,,2/27/2020 10:15,2/27/2020 10:15,,,,0,,,,CC BY-SA 4.0 +10016,1,,,2/27/2020 10:08,,4,473,"I have run a program on an IBM quantum experience machine which involves 5 qubits. Obviously when I measure the whole system I have 32 results but the machine only represents 20 in the histogram. In this situation the program tells you to download the results. The problem is that when I pick ""Download PNG"" or ""Download SVG"" it continues to show me a 20 results histogram. There is another option that is to pick ""Download results"" but it downloads two .json documents which I'm not sure I know how to change into a histogram.
+",10202,,5955,,2/27/2020 13:15,2/27/2020 13:15,How can I get the entire histogram in a 5 qubit program done in IBM quantum experience machine?,By clicking on Downloand you get two .json files as you mentioned. The results are saved in the file with suffix results.
+ +When you open the file in Notepad or any other text editor, you can find results in this form:
+ +""results"":[{""data"":{""counts"":{""0x0"":28,""0x1"":39,""0x10"":35,""0x11"":28,""0x12"":25,""0x13"":32,""0x14"":22,""0x15"":36,""0x16"":42,""0x17"":33,""0x18"":35,""0x19"":23,""0x1a"":34,""0x1b"":24,""0x1c"":29,""0x1d"":43,""0x1e"":34,""0x1f"":31,""0x2"":37,""0x3"":32,""0x4"":31,""0x5"":33,""0x6"":39,""0x7"":35,""0x8"":37,""0x9"":29,""0xa"":29,""0xb"":25,""0xc"":30,""0xd"":29,""0xe"":40,""0xf"":25}},
+
+
+States which are described by binary numbers in the graph on the result page in IBM Q interface are here described by hexadecimal numbers and showed together with number of occurences, for example:
+ +""0x13"":32
+
+
+This means that value $13_{16}=19_{10}=10011_2$ occured 32 times.
+ +You can extract these data from .json file manually, change hexadecimal numbers to binary and plot a histogram. For example, you can do it in Excel - hexadecimal numbers can be converted to binary ones with function HEX2BIN and then you can use bar graph instead of histogram.
+",9006,,,,,2/27/2020 10:55,,,,2,,,,CC BY-SA 4.0 +10018,1,,,2/27/2020 16:17,,3,51,"Recently, I have heard that the theory of modular representation can be involved with error correction in quantum information theory. However, from a point of view of mathematician, I am still quite unclear how modular representations can be used in error correction, could anyone here give some explanation? Some good references will also be helpful.
+",5693,,55,,10/28/2020 9:24,10/28/2020 9:24,How is the theory of modular representation involved with error-correction?,Probably each company (Google, Amazon, Intel, IBM, Microsoft, D-Wave and so on) uses a mix of subatomic particles and technologies. I would like to know which particles/technologies are used by each company.
+ +Are there specific reasons to choose a particular technology?
+",9797,,-1,,2/28/2020 15:40,11/9/2020 15:01,Which subatomic particle does each company use in quantum computing?,Google, IBM and Rigetti use transmon qubits; these are basically fancy LC circuits where a Josephson junction and capacitor connect two superconducting islands. Because of this, they are also often referred to as superconducting qubits. The qubit states are the various charge levels that can exist on the circuit; since the lowest two levels are separated in energy with respect to the higher levels, a two-level system arises. There are also other designs that encode the qubit in the charge levels, collectively they're therefore also known as the charge qubits.
+Intel also used superconducting qubits, but lately has also been interested in quantum dot qubits. A quantum dot is like a $0$-dimensional island on which a single electron can be placed; since the electron is a fermion it has only two natural states (and therefore makes a good qubit). The encoding can also be different, by encoding the qubit into two rather than one electron in the quantum dot (making use of the orthogonality of the singlet and triplet states). The go-to method of building a quantum dot is by using semiconductors (like silicium, known as the go-to material in classical computing); therefore they are also known as semiconducting qubits. Note that due to their extensive usage in classical computing, the engineering field of semiconductors is (at least relatively) very well developed.
+Microsoft is trying a different route: they are trying to built a topological quantum computer. This is a different type of quantum computer where the qubits are encoded in topological states of matter, using quasi-particles known as (non-Abelian) anyons. A likely candidate for a physical implementation is a Majorana fermion, which can act as an anyon. Such a Majorana fermion is its own anti-particle; no physical Majorana fermion (as opposed to the 'normal' Dirac fermion, e.g. electrons) has ever been found, but it could be realized as a quasi particle; a delocalized pair of electrons on a super-conducting bridge. It is worth noting that this is a considerably harder design than your 'run of the mill' transmons etc, but these topological states are intrinsically protected to many types of noise, thereby reducing or even omitting the need for quantum error correction. They live in the middle of the conductance-free gap of this superconductor, so that relatively small excitations (i.e. not pushing them out of that gap) are not 'allowed'.
+D-Wave's systems is based on a yet more different method of quantum computing: the adiabatic quantum computer or quantum annealer. The way computations are performed on these computers are not alike the circuit model (which is the most used model, exploited by transmons, super-conducting and semi-conducting qubits and the like). Moreover, the qubits themselves act very differently, and the comparison of 'adiabatic-syle' qubits and 'circuit-type' qubits is not a good or well-defined comparison. An adiabatic quantum computer needs many more qubits to have the same computational power as a circuit-based quantum computer, but they are (at least on paper) equally powerful (in terms of complexity classes). That means that the overhead is on paper is at most always polynomic. In an adiabatic quantum computer, the calculation's answer is encoded into the ground state of the entire system. It might therefore feel intuitive that these machines are particularly suited for optimization problems. It is also notable that there is still open discussion on whether the D-Wave-machines are 'universal' quantum computers, in the sense that they can do everything that an adiabatic QC needs to be able to do to be equivalent to a gate-based quantum computer. If you are familiar with the Ising model (basically a quantum annealer can calculate (the value of) the ground state of any Ising interaction): D-Wave's machines are not (yet) able to have any possible interaction term between qubits - they are able to do $\sigma_{z}\sigma_{z}$ interactions, but they also need either $\sigma_{x}\sigma_{x}$ or $\sigma_{y}\sigma_{y}$ interactions.
+There are also other types of qubits (that are not used by any of the companies you listed). Two to look out for are:
+Trapped-ion qubits. Qubits are encoded into states of ions; these ions are trapped by optical tweezers (light) and therefore localized and isolated. They (more or less) make use of the gate-based model of quantum computation; some restrictions apply because generally they can only be realized in a one-dimensional fashion. A big advantage is that the cooling requirements of this design is considerably less severe; room-temperature realizations are as far as I understand it not out of the question.
+Photonic quantum computation. Qubits are encoded into degrees of freedom of photons (=light), most often the polarization; time-bin encoding is also often used, especially when considering flying qubits. These photonic machines normally use the computation model of measurement based or one-way quantum computation, which is comparable to the circuit model but creates all entanglement in the beginning of the computation. This design also has the added benefit of not needing to cool the system. However, to be able to scale one needs many coherent photon-resources (where a laser won't do), which is a tough resource.
+There is no clear best implementation (yet). Transmon qubits are the most mature by most standards, but they are relatively big which will give big implications and problems when these devices will be scaled to include millions of qubits. Semiconducting qubits are a very interesting candidate because they are much smaller and implemented on (the very well developed technology of) semiconductors, but not much has been developed. Trapped ions are promising as well, but they can only be manufactured in a line (as a one-dimensional array of qubits). I'm interested to see what will happen with photonic quantum computers; they can be very promising but not many large companies are working on them; the measurement based model of QC is less popular. +A topological quantum computer is the dream of many, but for now it seems out of reach in the near future, due to the exceedingly exotic nature of its design.
+",8141,,8141,,11/9/2020 15:01,11/9/2020 15:01,,,,0,,,,CC BY-SA 4.0 +10022,1,10026,,2/28/2020 9:15,,1,190,"I was trying to implement the 2-qubit Grover algorithm without the auxiliary bit. Before finding the gate symbol for the controlled $\mathrm{Z}$, I worked with the controlled $\mathrm{Rz}$. The gate glossary states: "" $\mathrm{Z}$ is equivalent to $\mathrm{Rz}$ for the angle $\pi$"". So I thought the controlled $\mathrm{Rz}$ with angle $\pi$ should be equal with the controlled $\mathrm{Z}$ gate. However, I get very different results in the browser state-vector representation.
+ +So my question is, should they be equivalent?
+ + +",5461,,9006,,2/28/2020 12:03,2/28/2020 12:46,Are $\mathrm{cRz}$ with angle $\pi$ and $\mathrm{cZ}$ equal on the IBM Quantum Experience?,Why do all tutorials that use QSVM from qiskit Aqua library have the number of features equal to 2?
+",10213,,55,,7/27/2020 13:43,7/27/2020 13:43,Is there a limited number of features for QSVM in Qiskit-Aqua?,Every qubit is a realization of some two-level quantum system with $\left| 0 \right\rangle$ and $\left| 1 \right\rangle$ states. These states have their energies $E_0$ and $E_1$ respectively. By solving the Schrödinger equation for the two-level quantum system one can show time evaluation of the $\left| 0 \right\rangle$, $\left| 1 \right\rangle$ and $\left| + \right\rangle$ states:
+ +$$ +\left| \psi_0(t) \right\rangle = e^{-i \frac{E_0}{\hbar} t} \left| 0 \right\rangle \\ +\left| \psi_1(t) \right\rangle = e^{-i \frac{E_1}{\hbar} t} \left| 1 \right\rangle \\ +\left| \psi_+(t) \right\rangle = \frac{1}{\sqrt{2}}\left( e^{-i \frac{E_0}{\hbar} t} \left| 0 \right\rangle + e^{-i \frac{E_1}{\hbar} t} \left| 1 \right\rangle \right)= +\frac{e^{-i \frac{E_0}{\hbar} t}}{\sqrt{2}} \left(\left| 0 \right\rangle + e^{-i \frac{E_1 - E_0}{\hbar} t} \left| 1 \right\rangle \right) +$$
+ +My question is about the relative phase $\varphi = e^{-i \frac{E_1 - E_0}{\hbar} t}$. This $\phi$ acts as a phase gate and changes the quantum state. Is this relative phase important and how in real quantum computers we should deal with it? One problem that I see is the following circuit:
+ + + +After the measurement, the state should be $\left| 0 \right\rangle$, because $HH = I$. But If $t$ is such that the $\varphi = \pi$ then we will measure $\left| 1 \right\rangle$. We can forget about it if $\varphi(t) << \pi$ in the whole computational time. Otherwise, we should make sure that the time between gates should be $2\pi$.
+ +Is this a problem and if yes how IBM, Google or etc. deal with this problem when constructing the circuits? How I understand the frequency $(E_1 - E_0)/\hbar$ value is important and for example, the ibmq_armonk qubit's frequency is equal to ~4.97428 GHz (qiskit_textbook), so should we take into account this value when we play with ibmq_armonk by using OpenPulse?
+",9459,,9459,,2/28/2020 11:46,2/28/2020 11:46,How to deal with the relative phase from the evaluation of the not interacting qubit?,The could be a problem, but it depends on how you're realising your qubits. Some realisations are configured so that $E_0=E_1$, and then there's no problem.
+ +There is (at least from the theoretical perspective) a simple fix: if you're supposed to be waiting a time $t$, then, instead:
+ +This exchanges the roles of 0 and 1 for half the time so that they end up with equal phases.
+ +Alternatively, you just take this into account and apply compensating phase gates inside your circuit.
+",1837,,,,,2/28/2020 11:21,,,,4,,,,CC BY-SA 4.0 +10026,2,,10022,2/28/2020 12:02,,1,,"I realized that $\mathrm{Rz}(\lambda)$ is implemented in following way on IBM Q:
+ +gate crz(lambda) a,b
+{
+ u1(lambda/2) b;
+ cx a,b;
+ u1(-lambda/2) b;
+ cx a,b;
+}
+
+
+Setting $\lambda =\pi$, a matrix describing construction above is following: +$$ +\begin{pmatrix} +1 & 0 & 0 & 0 \\ +0 & 1 & 0 & 0 \\ +0 & 0 & -i & 0 \\ +0 & 0 & 0 & i \\ +\end{pmatrix} +$$
+ +This is not problem when the gate is not controlled as $i$ is a global phase, however, it matters for controlled gates.
+ +I also checked that these values are really returned for computation basis states in state vector visualization on IBM Q.
+ +Conclusion is that controlled $\mathrm{Rz}(\pi)$ is not equivalent to controlled $\mathrm{Z}$ on IBM Q.
+ +Note that application of single qubit $\mathrm{Rz}(\pi)$ returns same results as single qubit $\mathrm{Z}$.
+ +Solution:
+ +To make controlled $\mathrm{Rz}(\pi)$ behave as expected, you have to put controlled global phase gate before $\mathrm{Rz}(\pi)$. You can do that by application single-qubit gate $\mathrm{U1}(\pi/2)$ on controlling qubit of $\mathrm{Rz}(\pi)$, i.e. $q_0$ in your case.
+",9006,,9006,,2/28/2020 12:46,2/28/2020 12:46,,,,18,,,,CC BY-SA 4.0 +10027,2,,10023,2/28/2020 12:57,,3,,"Here is a tutorial that uses three classes! If you want to use more than two classes, you need a multiclass_extension
which is provided as a parameter to the QSVM
svm = QSVM(feature_map, training_input, test_input, total_array,
+ multiclass_extension=AllPairs(_QSVM_Estimator, [feature_map]))
+
+
+As shown in the tutorial. There are a few multiclass extensions to choose from, which are all here.
+",5955,,,,,2/28/2020 12:57,,,,0,,,,CC BY-SA 4.0 +10028,1,10097,,2/28/2020 14:18,,2,156,"IBM offers its platform IBM Q for free with certain constraints, such as available quantum processors and number of jobs running in parallel.
+ +I was wondering whether there is the same possibility on D-Wave quantum annealers. I looked at D-Wave web page but I was not able to find any useful information.
+ +Does anyone have any experience with D-Wave and possibility to at least sign up for free to some trial version?
+",9006,,55,,3/5/2020 9:14,3/5/2020 9:14,Is it possible to use D-Wave systems for free?,Sender (Alice) wants to exchange private encryption key with Bob using BB84 protocol. She generate a binary string (1010100010010111),and encode using Hadamard gate and identity gate (HHHIIHIHHIIIHIIH).
+ +What is the quantum state she transmits to reciever (Bob)?
+",9700,,55,,10/28/2020 9:24,10/28/2020 9:24,What is the quantum state transmitted to Bob in BB84 protocol?,when i try to call the VQE from qiskit I get an error of dimmismatch. The input matrix is of a 16x16 shape and I could not find out what where I introduce the error. In the picture The input matrix and the qubit0p is shown. I get the same error when trying to use QAOA as well
+ +Thank you for taking the time.
+ + self.C = self.C[:,:len(self.C[0])]
+ self.B = self.B[:,:len(self.B[0])]
+ print(""Input:"",self.C)
+ qubitOp = MatrixOperator(self.C)
+ print(qubitOp)
+ backend = Aer.get_backend('statevector_simulator')
+ var_form = RYRZ(qubitOp.num_qubits,10)
+ optim = COBYLA()
+ vqe = VQE(qubitOp, var_form, optim)
+ # Runs the VQE over the backend defined above.
+ result_vqe = vqe.run(backend)
+
+ print(qubitOp) # prints operator properties
+ print('energy', result_vqe['energy'], '\n')
+ print(result_vqe)
+
+
+Here is the error
+ +ValueError Traceback (most recent call last)
+<ipython-input-1-03f1f6dbe796> in <module>
+ 76 print_state(state)
+ 77
+---> 78 bundle_adjust(state)
+ 79 print(""= Bundle Adjusted State ="")
+ 80 print_state(state)
+
+<ipython-input-1-03f1f6dbe796> in bundle_adjust(state)
+ 39
+ 40 # note: intervene here with other optimizers
+---> 41 o.optimize()
+ 42
+ 43 # normalize scale (note: ~ is __invert__, *noisy is __imul__)
+
+~\Bachelor-Project\BA\optimizerVQE3.py in optimize(self)
+ 65 # run optimization
+ 66 def optimize(self):
+---> 67 for event in self.optimize_it():
+ 68 pass
+ 69
+
+~\Bachelor-Project\BA\optimizerVQE3.py in optimize_it(self)
+ 131
+ 132 # Runs the VQE over the backend defined above.
+--> 133 result_vqe = vqe.run(backend)
+ 134
+ 135 print(qubitOp) # prints operator properties
+
+~\Anaconda3\lib\site-packages\qiskit\aqua\algorithms\quantum_algorithm.py in run(self, quantum_instance, **kwargs)
+ 65 quantum_instance.set_config(**kwargs)
+ 66 self._quantum_instance = quantum_instance
+---> 67 return self._run()
+ 68
+ 69 @abstractmethod
+
+~\Anaconda3\lib\site-packages\qiskit\aqua\algorithms\adaptive\vqe\vqe.py in _run(self)
+ 314 if self._auto_conversion:
+ 315 self._operator = \
+--> 316 self._config_the_best_mode(self._operator, self._quantum_instance.backend)
+ 317 for i in range(len(self._aux_operators)):
+ 318 if not self._aux_operators[i].is_empty():
+
+~\Anaconda3\lib\site-packages\qiskit\aqua\algorithms\adaptive\vqe\vqe.py in _config_the_best_mode(self, operator, backend)
+ 236 ""achieve the better performance. We convert ""
+ 237 ""the operator to weighted paulis."")
+--> 238 ret_op = op_converter.to_weighted_pauli_operator(operator)
+ 239 return ret_op
+ 240
+
+~\Anaconda3\lib\site-packages\qiskit\aqua\operators\op_converter.py in to_weighted_pauli_operator(operator)
+ 86 list(itertools.product(possible_basis, repeat=num_qubits)),
+ 87 task_kwargs={""matrix"": operator._matrix},
+---> 88 num_processes=aqua_globals.num_processes)
+ 89 for trace_value, pauli in results:
+ 90 weight = trace_value * coeff
+
+~\Anaconda3\lib\site-packages\qiskit\tools\parallel.py in parallel_map(task, values, task_args, task_kwargs, num_processes)
+ 142 results = []
+ 143 for _, value in enumerate(values):
+--> 144 result = task(value, *task_args, **task_kwargs)
+ 145 results.append(result)
+ 146 _callback(0)
+
+~\Anaconda3\lib\site-packages\qiskit\aqua\operators\op_converter.py in _conversion(basis, matrix)
+ 36 def _conversion(basis, matrix):
+ 37 pauli = Pauli.from_label(''.join(basis))
+---> 38 trace_value = np.sum(matrix.dot(pauli.to_spmatrix()).diagonal())
+ 39 return trace_value, pauli
+ 40
+
+~\Anaconda3\lib\site-packages\scipy\sparse\base.py in dot(self, other)
+ 361
+ 362 """"""
+--> 363 return self * other
+ 364
+ 365 def power(self, n, dtype=None):
+
+~\Anaconda3\lib\site-packages\scipy\sparse\base.py in __mul__(self, other)
+ 478 if issparse(other):
+ 479 if self.shape[1] != other.shape[0]:
+--> 480 raise ValueError('dimension mismatch')
+ 481 return self._mul_sparse_matrix(other)
+ 482
+
+ValueError: dimension mismatch
+
+
+
+
+",10218,,,,,2/28/2020 17:37,VQE with error dim. mismatch using qiskit.aqua.vqe,In HHL algorithm, how do we implement matrix $A$ (where $A|x\rangle = |b\rangle$) in the circuit?
+",9973,,9006,,2/28/2020 22:50,3/2/2020 8:41,Implementation of matrix A in HHL algorithm circuit,The matrix you are printing seems to have 30 entries in each. When converting to Paulis form to run it expects the dimension to be a power of 2.
+ +This code below (based on yours) does run when given a 16x16.
+ +import numpy as np
+from qiskit import Aer
+from qiskit.aqua.algorithms import VQE
+from qiskit.aqua.components.optimizers import COBYLA
+from qiskit.aqua.components.variational_forms import RYRZ
+from qiskit.aqua.operators import MatrixOperator
+
+np.random.seed = 75
+matrix = np.random.rand(16, 16)
+qubitOp = MatrixOperator(matrix)
+print(qubitOp)
+backend = Aer.get_backend('statevector_simulator')
+var_form = RYRZ(qubitOp.num_qubits,10)
+optim = COBYLA()
+vqe = VQE(qubitOp, var_form, optim)
+result_vqe = vqe.run(backend)
+
+print(qubitOp) # prints operator properties
+print('energy', result_vqe['energy'], '\n')
+print(result_vqe)
+
+
+",9831,,,,,2/28/2020 17:37,,,,0,,,,CC BY-SA 4.0
+10034,1,,,2/28/2020 21:52,,3,59,"I'm reading the paper Implementation of the Quantum Fourier Transform. On page 4, they write
+++To a first approximation, decoherence during the course of the QFT attenuates the entire density matrix. This is shown in figure 2.
+
I know that the word "attenuate" means to dampen or reduce the force of something. Since density operators have trace one, perhaps this means that the QFT decreases the trace of the density operator.
+My question is: What is meant by attenuate here?
+",6118,,2293,,3/1/2021 22:54,3/1/2021 22:54,"What does ""decoherence attenuates the density matrix"" mean?",Application of Hadamard gates changes states $|0\rangle$ and $|1\rangle$ followingly:
+ +Identity operator does not change the state in any way, i.e. $\mathrm{I}|0\rangle = |0\rangle$ and $\mathrm{I}|1\rangle = |1\rangle$.
+ +Hence if gates $\mathrm{HHHII}\dots$ are applied on input string of qubits $|10101\dots\rangle$, the result is state $|-+-01\dots\rangle$.
+",9006,,,,,2/28/2020 22:48,,,,0,,,,CC BY-SA 4.0 +10036,2,,10031,2/28/2020 23:01,,3,,"A Hermitian matrix $A$ is implemented as series of controlled gates $\mathrm{e}^{iAt}$ for some $t$. This gate can be then implementend with controlled $\mathrm{U3}$ gate on IBM Q.
+ +Note that original paper on HHL algorithm (see link below) provides a ""trick"" how to convert any matrix to Hermitian one and apply HHL algrithm.
+ +For example, for Hermitian matrix $A$, type 2x2, there are two gates with $t=\frac{\pi}{2}$ and $t=\frac{\pi}{4}$ controlled by two different qubits.
+ +Please see these articles for more information how to implement HHL algorithm:
+ +I would recommend the third article for the best understanding how to implement HHL algorithm in practice.
+",9006,,9006,,3/2/2020 8:41,3/2/2020 8:41,,,,4,,,,CC BY-SA 4.0 +10037,1,10039,,2/29/2020 12:05,,1,221,"I'm running VQE algorithm from qiskit aqua on statevector_simulator
and each time I run it I get different results which are sometimes correct and sometimes not. I'm not sure if I'm setting parameters correctly.
Here is my code:
+ +The qubitOp
is generated with DOcplex module.
max_trials = 80
+depth = 1
+entanglement='full'
+
+slsqp = SLSQP(maxiter=max_trials)
+ry = RY(qubitOp.num_qubits, depth=depth, entanglement=entanglement)
+vqe = VQE(qubitOp, ry, slsqp)
+provider = IBMQ.get_provider('ibm-q')
+backend = Aer.get_backend('statevector_simulator')
+quantum_instance = QuantumInstance(backend,seed_simulator=seed, seed_transpiler=seed, optimization_level=0)
+res = vqe.run(quantum_instance)
+
+",10234,,9006,,3/1/2020 9:44,3/1/2020 9:44,Qiskit statevector_simulator returns different results,VQE has an initial_point parameter, which is the starting point it uses for the optimization. In the absence on one being provided (or suggested via the variational form) it will pick a random one. You can seed Aqua, like you did the simulator, so it will end up with the same random one each time, to get a predictable outcome. Add the following to do this before using any Aqua algorithms etc.
+ +from qiskit.aqua import aqua_globals
+
+aqua_globals.random_seed = seed
+
+
+Now since your result varies it suggests anyway that you are not reaching a minimum and the optimization loop is ending early. More iterations of the optimizer may be needed and/or you may need to look at the variational form, say larger depth with what is being used.
+",9831,,9831,,2/29/2020 13:55,2/29/2020 13:55,,,,0,,,,CC BY-SA 4.0 +10043,1,,,2/29/2020 20:07,,1,110,"Cirq has two in-built realizations of quantum hardware, which are realized as GridQubit() and LineQubit() classes (naming convention is slightly disturbing:).
+ +GridQubit device mimics connectivity of Google's quantum chips (Bristlecone, Sycamore) and qubits are arranged in a 2D grid with nearest-neighbor couplings. +https://github.com/quantumlib/Cirq/blob/master/cirq/devices/grid_qubit.py
+ +LineQubit device represents chips with 1D geometry, where qubits are arranged in a line and again only nearest-neighbor qubits are coupled.
+ +Is there any possibility to specify a custom hardware coupling map? E.g. to specify adjacency matrix of new connectivity graph?
+ +It seems that a user has to create his/her own device class for such functionality.
+",7896,,,,,2/29/2020 20:22,Cirq: creating a new device with custom coupling topology?,Generally, yes, it is expected that you would define your own device and perhaps your own qubits in order to make custom topologies.
+ +There is currently a graph device package in the ""contrib"" package, which allows you to specify the connectivity graph for a device. But as with anything in contrib it may be a bit clunky and could disappear/change from version to version.
+ +import cirq.contrib.graph_device
+
+",119,,,,,2/29/2020 20:22,,,,0,,,,CC BY-SA 4.0
+10045,1,,,3/1/2020 4:51,,3,37,"My understanding is the Helstrom measurement distinguishes between 2 pure quantum states.
+ +Is there a measure similar to the Helstrom measurement which can distinguishes between more than 2 pure quantum states? Or can the Helstrom measurement be generalized to do this?
+",10241,,55,,10/28/2020 9:23,10/28/2020 9:23,Is there a measure similar to the Helstrom measurement which can distinguish between more than 2 pure quantum states?,Someone on research gate said the answer was no
+ +++ +Our brain is a neural network with a very complex connectome. Any system is in a sense a computer adhering quantum mechanics, but what is known about human brain doesn’t tell us it uses quantum-mechanical effects such as entangled states and superposition states as en essential element of computation.
+
So the human brain is more like a classical computer Or is the brain not like a Turing machine?
+",,user10151,,,,3/2/2020 4:34,Do biological brains compute using quantum mechanics?,As far as we know - and I know, so correct me anyone if there's research to the contrary - the neuron interactions in the brain are well within the classical regime.
+ +https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5681944/
+",6253,,,,,3/1/2020 21:10,,,,2,,,,CC BY-SA 4.0 +10049,1,,,3/1/2020 21:54,,1,96,"Consider a Hamiltonian $H = \sigma_x \otimes \sigma_z$ +Construct the time evolution operator $U(t) = \mathrm{e}^{-\frac{iHt}{\frac{h}{2\pi}}}$ [Hint:Write down the expansion of $\mathrm{e}^x$ and use the property of $H^2$]
+ +This was one of my assignment problems and I really couldn't make sense of what the hint implied and ended up getting $H^2 = I$ and don't really know how and where to use this.
+",10247,,55,,7/26/2020 18:08,7/26/2020 18:08,Constructing a time evolution operator $e^{it H}$ for $H^2=I$,Suppose we have the Fredkin gate with
+ +$$ + F= + \left( {\begin{array}{cc} + 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ + \end{array} } \right) +$$
+ +But how is it possible to ""see"" what its action is without making any matrix multiplication?
+ +In this document, on solving 4.25, they claim that the action of $F$ is, in the computational basis, $F|0,y,z\rangle=|0,y,z\rangle$ and $F|1,y,z\rangle=|1,z,y\rangle$. But how is it possible to know this beforehand? I feel that I am missing this mental ""gymnastic"" that I feel is crucial for developing algorithms.
+",5620,,734,,3/2/2020 14:09,3/2/2020 14:09,"How can I see, without math, the action of a gate in matrix form?",We care about $F$'s action on the basis states, where basis states are represented by
+ +\begin{equation}\begin{pmatrix} 1\\0\\0\\0\\0\\0\\0\\0 \end{pmatrix}, \begin{pmatrix} 0\\1\\0\\0\\0\\0\\0\\0 \end{pmatrix}, \ldots, \begin{pmatrix} 0\\0\\0\\0\\0\\0\\0\\1 \end{pmatrix}\end{equation}
+ +It should be fairly easy to see that on most basis states, this gate will act as the identity. The only exceptions are $(0,0,0,0,0,1,0,0)^T$ and $(0,0,0,0,0,0,1,0)^T$, which get swapped.
+ +States of the form $|0yz\rangle$ are those with a one in one of the first four rows. Clearly these don't get swapped.
+ +States of form $|1yz\rangle$ have a one in one of the last four rows. Look how they get mapped:
+ +\begin{align} +|1yz\rangle :=|100\rangle &\mapsto |100\rangle = |1zy\rangle\\ +|1yz\rangle :=|101\rangle &\mapsto |110\rangle = |1zy\rangle\\ +|1yz\rangle :=|110\rangle &\mapsto |101\rangle = |1zy\rangle\\ +|1yz\rangle :=|111\rangle &\mapsto |111\rangle = |1zy\rangle\\ +\end{align}
+ +as desired. What might be tripping you up is the fact that mapping $|100\rangle$ to $|100\rangle$ (and similarly for $|111\rangle$) can technically be thought of as swapping the last two bits.
+ +What's the intuition? This gate is very close to being diagonal. It's easy to see the action of a diagonal matrix on a vector (especially a vector with only one nonzero entry, i.e. computational basis states), so my first instinct was to look at that action, and then assess where it deviates from diagonality and try to figure out what that deviation actually does.
+",6118,,,,,3/2/2020 0:51,,,,0,,,,CC BY-SA 4.0 +10052,2,,10049,3/2/2020 0:56,,1,,"The exponential of an operator is defined with respect to its series expansion. The fact that $H^2=I$ will simplify this expansion greatly.
+",332,,9006,,3/2/2020 5:42,3/2/2020 5:42,,,,0,,,,CC BY-SA 4.0 +10053,2,,10049,3/2/2020 0:59,,2,,"Here is a hint:
+ +You are correct that $H^2 = I$. Let's set $a:=\frac{-2it\pi}{h}$ for simplicity. Then the definition of the matrix exponential gives us
+ +$$U(t) = \sum_{n=0}^\infty \frac{a^n}{n!}H^n$$
+ +Can you use $H^2 = I$ to help evaluate this?
+",6118,,,,,3/2/2020 0:59,,,,0,,,,CC BY-SA 4.0 +10054,2,,10047,3/2/2020 4:34,,2,,"There is evidence that quantum coherence and it's role in chemical reactivity is responsible for the magnetic field sensing in migratory birds, the so called avian compass, https://arxiv.org/abs/1206.5946v1.
+ +Similar quantum effects and chemistry could very well be occuring and playing a role in the brain, though as far as I know there isn't anything published in that direction. And even if there is a role for quantum coherent effects, it is likely a far cry from how we think about quantum computing.
+",9579,,,,,3/2/2020 4:34,,,,0,,,,CC BY-SA 4.0 +10055,2,,10050,3/2/2020 8:10,,2,,"For a 0/1 matrix, the sort of protocol that I use is to write out the basis in the standard order. For three qubits, this is: 000,001,010,011,100,101,110,111 (the numbers 0 to 7 written in order in binary). You can list these next to the rows and the columns. Now, a given 1 entry in the matrix has a specific row and column (and there is only one of these for each row and column). The matrix acts to transform the column label into the row label.
+ +So, for example, the first 4 elements $0xy$ all transform into themselves (because that part of the matrix is identity). Whereas 110 (penultimate column) transforms into 101, the 6th row.
+",1837,,,,,3/2/2020 8:10,,,,0,,,,CC BY-SA 4.0 +10056,2,,10050,3/2/2020 8:46,,10,,"Besides the already given answers note that there is indeed some ""mental gymnastics"" involved here. As soon as you're getting more acquainted with quantum computing, you know some of your usual gates, including the $\mathsf{SWAP}$ gate that appears in your question: +\begin{align} +\mathsf{SWAP} = \begin{bmatrix} + 1 &0 &0 &0 \\ + 0 &0 &1 &0 \\ + 0 &1 &0 &0 \\ + 0 &0 &0 &1 \\ +\end{bmatrix} +\end{align}
+ +Now, how do we see that the Fredkin gate corresponds to a controlled $\mathsf{SWAP}$ gate? Looking closer at the Fredkin gate shows us that it has a block structure where the upper left block is an identity matrix and the lower right block is the $\mathsf{SWAP}$ gate: +\begin{align} +\mathsf{Fredkin} = \mathsf{CSWAP} = \begin{bmatrix} + \mathbb{I} & 0 \\ +0 & \mathsf{SWAP} +\end{bmatrix} +\end{align}
+ +And this structure is in fact general! All gates that are controlled on the first qubit have this block structure. Consider for example the well known $\mathsf{CNOT}$ gate +\begin{align} +\mathsf{CNOT} = \begin{bmatrix} + 1 &0 &0 &0 \\ + 0 &1 &0 &0 \\ + 0 &0 &0 &1 \\ + 0 &0 &1 &0 \\ +\end{bmatrix}= \begin{bmatrix} + \mathbb{I} & 0 \\ +0 & X +\end{bmatrix} +\end{align} +which is an identity matrix on the upper left (hence the $\mathsf{C}$ in $\mathsf{CNOT}$) and a Pauli $\mathsf{X}$ gate -- which is the quantum $\mathsf{NOT}$ gate -- on the lower right.
+ +So why is this the case? As pointed our by DaftWullie, we assume that the basis vectors in our Hilbert space correspond in ascending order to our basis states, i.e. +\begin{align} +000, 001, 010, 011, 100, 101, 110, 111 +\end{align} +for three qubits. If we want to perform an arbitrary unitary $\mathsf{U}$ on the second and third qubit controlled by the first qubit, the corresponding matrix must act trivially (i.e. as identity matrix) on the first 4 basis vectors, just because for them the control bit is $0$. On the last 4 basis vectors, the control bit is $1$ and the operation $U$ is thus performed on these basis vectors. As the control bit must not change under the whole operation, the basis states starting with $0$ and the basis states starting with $1$ can not mix, yielding the overall matrix structure +\begin{align} +\mathsf{CU} = \begin{bmatrix} + \mathbb{I} & 0 \\ +0 & \mathsf{U} +\end{bmatrix} +\end{align}
+",10250,,-1,,3/2/2020 14:09,3/2/2020 14:09,,,,2,,,,CC BY-SA 4.0 +10057,1,,,3/2/2020 14:00,,6,261,"I would like to check something.
+Consider I am working on cQED (superconducting qubits), or ion trapped, or silicon qubits (I would like to exclude "exotic for me" quantum computing like photon based, or topological Q.C).
+The fastest you perform a gate, the less the noise has the time to act for noise "per unit time" acting (not all noise can be modelled this way but it can often be).
+It is thus important to perform gate "the fastest possible".
+My question is thus: What is limiting gate speed ?
+About limitations I know: for superonducting qubit too short pulses are not a good solution as it might excite the system into higher than qubit level (making it leave the computational space). I would like to know what are the main limitations in general because I guess this is not the only one.
+",5008,,5008,,11/12/2020 23:18,12/13/2020 9:07,What limits speed of quantum gates?,In article Quantum computational finance: Monte Carlo pricing of financial derivatives the authors said that:
+ +Firstly:
+ +++ +While a practical quantum computer has yet to become + a reality, we can exhibit the speedup of our quantum + algorithm for options pricing numerically, and compare + its performance with the classical Monte Carlo method.
+
Secondly:
+ +++ +However, to showcase the + quadratic speed up, we here perform phase estimation by + using a single qubit rotated according to $\mathrm{e}^{i\theta\sigma_x /2}$, where $\theta$ is the predetermined phase.
+
If my understanding is correct, it is possible to simulate efficiently a circuit consisting only of Clifford gates. Since an inverse QFT is employed in the circuit, at least one $\mathrm{T}$ should be use here (QFT for three or more qubits). However, in the second quotation the authors claim that they used only a single qubit gate for phase estimation which reduced number of qubits in the inverse QFT and avoided the use of non-Clifford gates.
+ +So my questions is: Have the authors used Clifford gates only in their construction or am I missing something? So far, I have thought that simulation of quantum computer cannot bring any speedup even in case only Clifford gates are employed.
+",9006,,9006,,3/3/2020 5:45,3/10/2020 11:47,Is it possible to demonstrate a quadratic speed-up of a quantum algorithm on a classical computer?,Consider the standard quantum teleportation scheme. Let the first register hold the state $\newcommand{\ket}[1]{|#1\rangle}\ket\psi$ to be teleported, and the second register be the one shared between the two parties. We can then summarise the protocol as follows:
+ +My question is about the choice of this specific unitary $U$: +Consider the following generalisation of the teleportation scheme:
+ + + +Here, we again start with $\ket\psi\otimes\ket{0,0}$, but now apply some unitary $B$ between second and third register and then $B^{-1}$ between first and second. We then measure the first two registers in the computational basis.
+ +What are the possible unitaries $B$ such that this circuit works as a teleportation protocol? More specifically, for what choices of $B$ can we always find a unitary to apply to the third register to get back $\ket\psi$ regardless of the measurement results $a,b$?
+ +Intuitively, $B$ must be some gate creating maximal entanglement between the qubits, but requiring that $B$ sends $|00\rangle$ to a maximally entangled state is also not enough. As a counterexample, we can consider the following $B$: +$$B\equiv \begin{pmatrix} + 0&0&1&0 \\ + 1/\sqrt2 & 1/\sqrt2 & 0 & 0 \\ + 1/\sqrt2 & -1/\sqrt2 & 0 & 0 \\ + 0 & 0 & 0 & 1 +\end{pmatrix}.$$ +It is not hard to check that with this choice teleportation is not possible, despite the two parties sharing a maximally entangled state. For example, the outcome $a=b=1$ projects the third qubit to $\ket0$, which contains no information about $\ket\psi$.
+",55,,55,,5/12/2020 9:11,4/16/2022 18:18,Generalising the standard quantum teleportation protocol: what are the possible unitaries?,A necessary and sufficient condition on the unitary $B$ is that its columns all correspond to maximally entangled states.
+ +There also does not need to be any relationship between the two unitaries labeled $B$ and $B^{-1}$ in your figure: as long as you start with a maximally entangled state of systems 2 and 3, and then measure systems 1 and 2 with respect to an orthonormal basis of maximally entangled states, there will be an operation (which depends on the measurement outcome) on system 3 that recovers the original state.
+ +Moreover, this is all true not only for qubits, but for any single dimension $d$ shared by systems 1, 2, and 3.
+ +These facts were proved by Werner:
+ +++",1764,,55,,3/3/2020 10:48,3/3/2020 10:48,,,,4,,,,CC BY-SA 4.0 +10062,2,,2667,3/3/2020 5:58,,4,,"R. Werner. All teleportation and dense coding schemes. Journal of Physics A 34: 7081-7094, 2001 (link to paper).
+
I enrolled to Introduction to Quantum Computing on Coursera.
+The course provides basics of quantum computing mathematical model and then introduce basics algorithms: Deutch-Jozsa algorithm, Simon algorithm, quantum Fourier transform, Shor algorithm and Grover algorith.
+The course requires understanding of linear algebra, necessary basics of quantum mechanics are explained during the course.
+Interestingly, the course shows how to build single-purpose quantum computer for implementation of Deutsch-Jozsa algorithm.
+The course if for free unless you want a certificate. In that case it costs $49.
+",9006,,-1,,6/18/2020 8:31,3/3/2020 5:58,,,,0,,,,CC BY-SA 4.0 +10063,2,,2667,3/3/2020 6:22,,4,,"Maybe be a bit of left field but I found Peter Wittek - may he Rest In Peace - course on edX quite good.
+ +https://www.edx.org/course/quantum-machine-learning
+",6253,,6253,,3/3/2020 22:32,3/3/2020 22:32,,,,0,,,,CC BY-SA 4.0 +10064,2,,2667,3/3/2020 7:40,,4,,"Currently there are not much courses available. However you can start with following courses:
+ +Then, to focus a particular area, you can go for:
+ +I'm a bit confused about which is the correct sign in the unitary evolution operator of a beam splitter.
+ +In paper Digital quantum simulation of linear and nonlinear optical elements author uses the following expression:
+ +$$U_{ij} = e^{i\epsilon_{ij}\left(b_j^\dagger a_i + b_j a_i^\dagger \right)} $$
+ +where $i,j$ refers to the beam splitter modes (so, what is the meaning of $a$ and $b$?)
+ +However, Nielsen & Chuang use (on page 291) the following equation for the same thing: +$$ U = e^{\theta\left(a^\dagger b - a b^\dagger\right)},$$ +where the latter term in the exponent has a minus sign.
+ +How can I relate both equations? Are they the same?
+ +Lastly, can you recommend me any book which deals with beam splitter and related stuff? I have not found any good reference.
+",9716,,55,,3/4/2020 10:48,3/4/2020 10:48,What is the correct sign in the unitary evolution operator of a beam splitter?,How would you explain, pictorially and without too much overhead, an interaction between the qubits on this model using Cirq?
+ +I am interested in trying to map accurately the ansatz on Cirq to a graph using Python network's library.
+ +I know this is a bit open-ended. What I am looking for are suggestions and examples to take a look at - besides the obvious one at Cirq's docs.
+ +Thank you.
+",6253,,5955,,3/4/2020 9:32,3/18/2020 20:57,"Ising Model, Graphs, and Cirq",I'm fairly new to the Qiskit API. I was wondering if I could get some assistance with trying to implement our technique of projecting out a new Hamiltonian from the ground-state Hamiltonian. The technique is discussed in our preprint.
+ +There are two main challenges that I'm confronted with:
+ +qubitop.aer_pauli[i,:] = 1.0 + 0.0j
+should work, but I'm not sure this is complete or an appropriate approach.This would enable us to then use the VQE routines with Qiskit to further verify this method.
+ +I'm looking to make these modification to the Qiskit source code just need some guidance.
+",10265,,9006,,3/4/2020 5:08,3/4/2020 15:33,Modifying Qiskit Hamiltonian,First, the operators $a$ and $b$ ($a^{\dagger}$ and $b^{\dagger}$) are the annihilation (creation) operators of the two photonic modes in your problem. For an introduction to the subject I recommend you to look for some decent lecture notes on quantum optics. A well readable introductory book is Mark Fox's ""Quantum Optics -- An Introduction"" and a more advanced read is Grynberg, Aspect and Fabre's ""An Introduction to Quantum Optics"". But the parts you are interested in are possibly well explained in Nielsen and Chuang. Also this document I found while googling might be of interest.
+ +But back to the original question: why does the paper you mention and the Wikipedia article define the beamsplitter as +\begin{align} +U = \mathrm{e}^{i \theta (b^{\dagger} a + b a^{\dagger})} +\end{align} +with a plus sign, contrary to Nielsen and Chuang?
+ +The truth is, both operators are ""correct"", they just describe polarizing and non-polarizing beamsplitters. The beamsplitters usually encountered in labs are polarizing, so that the reflected photon obtains an additional phase shift.
+ +This is actually explained quite neatly in Box 7.3 of Nielsen and Chuang, where they show that there is an isomorphism between the transformation of two photonic modes and $SU(2)$. The plus convention corresponds to a Pauli $X$ rotation, where the minus convention corresponds to a Pauli $Y$ rotation. As pointed out before, there is an additional phase shift, embodied by the phase operator +\begin{align} +S = \begin{bmatrix} 1 & 0 \\ 0 & i \end{bmatrix} +\end{align} +that can be used to relate the two transformations. For that see Page 51 of ""Introduction to Optical Quantum Information Processing"" by Kok and Lovett.
+",10250,,,,,3/3/2020 23:32,,,,0,,,,CC BY-SA 4.0 +10069,2,,10065,3/4/2020 0:30,,0,,"Just replace $a$ by $a'=ia$, this maps one unitary to the other.
+",491,,,,,3/4/2020 0:30,,,,0,,,,CC BY-SA 4.0 +10070,1,10071,,3/4/2020 5:38,,3,336,"I am following Nielsen and Chuang, section 2.2.5:
+ +++ +A projective measurement is described by an observable, $M$, a Hermitian + operator on the state space of the system being observed. The + observable has a spectral decomposition, $$M = \sum_m mP_m$$ + where $P_m$ is the projector onto the eigenspace of $M$ with eigenvalue $m$. The possible outcomes of the measurement correspond to the eigenvalues, $m$, of the observable.
+
My question is how can we view a the projective measurement of two qubits in the standard (Z) basis using this formalism. In this measurement the projectors are +$$\left|00\right\rangle \left\langle 00\right|, \left|01\right\rangle \left\langle 01\right|, \left|10\right\rangle \left\langle 10\right|, \left|11\right\rangle \left\langle 11\right|$$
+ +But how can I find them if I only know of the observable, which in this case is $Z\otimes Z$ if I understand correctly?
+ +This observable has only two eigenvalues: $+1$ and $-1$. The eigenvalue $+1$ corresponds both to $\left|00\right\rangle$ and $\left|11\right\rangle$, so it seems to me I need a ""stronger"" observable, which can differentiate those two states, or I'm missing a something elementary in the definition of projective measurements.
+",9918,,9006,,3/4/2020 7:44,3/4/2020 12:18,Viewing two-qubit measurement as a projective measurement,$Z\otimes Z$ is an observable which specifies a measurement but, as you have realised, it's not specific enough to fix it as being the measurement you want. There's no unique way of doing this, but you could use something like +$$ +2Z\otimes I+I\otimes Z +$$ +If you work this out, you'll see it's diagonal, with distinct elements on each diagonal, which is what you need.
+",1837,,,,,3/4/2020 7:49,,,,0,,,,CC BY-SA 4.0 +10072,1,,,3/4/2020 9:14,,1,67,"What is the implementation of quantum superdense coding protocol if the sender and receiver share the entangled state +$ +\frac{1}{\sqrt{2}} (\left| 01 \right> - \left| 10\right>) +$?
+",9700,,55,,3/5/2020 15:53,3/5/2020 15:53,What is the implementation of the state in superdense coding?,As defined, CNOT should for the two input states $|0\rangle = \pmatrix{1 \\ 0}$ and $\pmatrix{\alpha \\ \beta}$ should result in the second state unchanged: $\pmatrix{\alpha \\ \beta}$. However, to me it does not seem to be the case.
+ +The matrix for CNOT is defined as:
+ +$$\pmatrix{1\;0\;0\;0 \\ 0\;1\;0\;0 \\ 0\;0\;0\;1 \\ 0\;0\;1\;0}$$
+ +Now, I am not sure how to interpret the two input states, it makes sense to me to use their XOR as the input:
+ +$$\pmatrix{1 \\ 0} \otimes \pmatrix{\alpha \\ \beta} = \pmatrix{ \alpha \\ 0 \\ \beta \\ 0 }$$
+ +Now:
+ +$$\pmatrix{1\;0\;0\;0 \\ 0\;1\;0\;0 \\ 0\;0\;0\;1 \\ 0\;0\;1\;0} \pmatrix{ \alpha \\ 0 \\ \beta \\ 0 } = \pmatrix{\alpha \\ 0 \\ 0 \\ \beta}$$
+ +which is a state impossible to write as XOR of two states. Besides obviously being different from the first one, even though it should not have changed.
+ +How is that?
+",10270,,9006,,3/4/2020 13:04,3/4/2020 13:04,How does the CNOT gate work?,An observable having degenerate eigenvalues means that it doesn't completely collapse the system. For example, $Z\otimes Z$ would describe a type of measurement in which you are only asking whether the state is in the span of $\{|00\rangle,|11\rangle\}$ or in the span of $\{|01\rangle,|10\rangle\}$. This means that, for example, this type of measurement would leave a state such as $|00\rangle+|11\rangle$ unperturbed, but make a state like $|00|\rangle+|01\rangle$ collapse in either $|00\rangle$ or $|01\rangle$.
+ +If you want to model a measurement which distinguished between all elements of the computational basis, you can use any non-degenerate observable. The specific eigenvalues will only depend on what you want to do with your observations.
+",55,,,,,3/4/2020 12:18,,,,0,,,,CC BY-SA 4.0 +10077,1,10091,,3/4/2020 13:03,,4,274,"I'm trying to implement an modular adder mentioned here with qiskit. I have already built the $\Phi ADD$ gate. But in order to build a modular adder like in figure 5 in the paper, I need to build a doubly-controlled $\Phi ADD$ gate. Qiskit offers a method to transfer a circuit to a controlled gate, but now I need a doubly controlled gate. I know I can use something like this, but that need an additional qubit, which is undesired. I also know that I can use this method, but I don't know how to implement the square root of $\Phi ADD$ gate. Is there any other method to do this (creating a doubly-controlled gate from the $\Phi ADD$ gate I built without adding any additional qubits)?
+",9153,,9153,,3/4/2020 13:39,3/4/2020 17:42,Make a doubly controlled gates from existing operations,The problem is tensor product which you have calculated wrongly. A correct calculation is this:
+ +$$ +\begin{pmatrix} 1 \\ 0 \end{pmatrix} +\otimes +\begin{pmatrix} \alpha \\ \beta \end{pmatrix} += +\begin{pmatrix} \alpha \\ \beta \\ 0 \\0 \end{pmatrix} +$$
+ +If you now apply CNOT gate you have
+ +$$ +\begin{pmatrix} +1 & 0 & 0 & 0 \\ +0 & 1 & 0 & 0 \\ +0 & 0 & 0 & 1 \\ +0 & 0 & 1 & 0 \\ +\end{pmatrix} +\begin{pmatrix} \alpha \\ \beta \\ 0 \\0 \end{pmatrix} += +\begin{pmatrix} \alpha \\ \beta \\ 0 \\0 \end{pmatrix}, +$$
+ +which means that the second qubit is unaffected.
+",9006,,,,,3/4/2020 13:03,,,,0,,,,CC BY-SA 4.0 +10079,2,,10075,3/4/2020 13:03,,3,,"Where you say ""xor"", you should mean (and, indeed, you're using the notation for) the tensor product. However, you have not calculated the tensor product correctly. You should be getting $[\alpha,\beta,0,0]^T$ before application of the cnot, and hence $[\alpha,\beta,0,0]^T$ after the action of the cnot as well.
+",1837,,,,,3/4/2020 13:03,,,,0,,,,CC BY-SA 4.0 +10080,2,,10072,3/4/2020 13:22,,2,,"If you apply $\mathrm{X}$ on second qubit, you will get state +$$ +\frac{1}{\sqrt{2}}(|00\rangle - |11\rangle) +$$
+ +After that you can apply $\mathrm{Z}$ on second qubit as well to get Bell state $\beta_{00}$: +$$ +\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle) +$$
+ +Now you can employ superdense conding as usual.
+ +Note: matrix description of above mentioned operations is $(\mathrm{I}\otimes\mathrm{Z})(\mathrm{I}\otimes\mathrm{X})$.
+ +Here is a circuit for doing all mentioned above:
+ + + +A first part prepares state $|\psi_0\rangle = \frac{1}{\sqrt{2}}(|01\rangle - |10\rangle)$. This is an initial state you questioned about. Second part changes $|\psi_0\rangle$ to $\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$, i.e. Bell state $\beta_{00}$. Now you can apply superdense coding as usual - this is symbolized by gates $\mathrm{X}$ and $\mathrm{Z}$ (of course, application of these gates depends on two bits you want to encode, e.g. for encoding string 00 you will apply neither gate). Last part is measuring in Bell basis - again usual part of superdense coding.
+",9006,,9006,,3/4/2020 14:48,3/4/2020 14:48,,,,4,,,,CC BY-SA 4.0 +10081,1,10084,,3/4/2020 13:59,,3,211,"What will happen if the 'blackbox' function $f$ in Deutsch's algorithm is designed in such a way that it takes millions of years to deliver result if input is $x = 1$ and few seconds if the input is $x = 0$?
+ +How long would it take the oracle $U_f$ to calculate $f$ for all inputs? My understanding is that $U_f$ has such quantum properties, that given a state $|\psi \rangle$ as a superposition of two qubits it will apply $U_f$ (and thus apply internally $f$) to each base state of $|\psi \rangle$ simultaneously.
+ +In the scenario I've described $f$ will, however, take different execution times for different inputs. Will then there be a delay until all base states are evaluated by $ U_f$ (or more precisely by $f$)?
+",10264,,,,,3/4/2020 14:30,What happens with the oracle $U_f$ if you have different blackbox execution times for different inputs?,If I download calibration of a quantum processor on IBM Q website I see these parameters:
+ +T1 and T2 are relaxation and dephasing times, respectively.
+ +What are the other parameters?
+",9006,,5955,,3/4/2020 14:26,3/4/2020 14:33,IBM Q calibration parameters,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.
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.
One implements $U_f$ with one circuit that acts on qubit(s) in the superposition state. This means that no matter what is the input (basis state in the superposition), we act on the qubits with the same circuit and it takes the same execution time (the same number of gates in the circuit) for all possible inputs. So, how I understand, the scenario of different times of execution depending on the inputs is not possible. We always apply the same set of gates that implement the $U_f$.
+",9459,,9459,,3/4/2020 14:30,3/4/2020 14:30,,,,4,,,,CC BY-SA 4.0 +10085,2,,10082,3/4/2020 14:26,,6,,"I am trying to set up my qiskit environment but I seem to have run in trouble that I have no idea how to solve. I have installed the qiskit packages as can be seen by running pip list
:
however whenever I try to import qiskit.visualization
an error occurs:
and I don't understand why since it was suppose to be installed as qiskit
module is installed. Any idea where this error comes from?
You are running a very old version of qiskit, I would recommending updating and this error should go away. You can do this by running pip install qiskit --upgrade
I have updated qiskit to the newest version using pip install qiskit --upgrade
and all was done successfully, and when I write pip list
on the command line I get:
As I should. But then I run help(""modules"")
on a jupyter notebook and get:
which I don't understand why are there no other modules. And obviously import qiskit
throws an error as well. Any idea how to solve this?
PS: This is a follow-up from this question
+",5620,,,,,3/4/2020 16:06,"Why doesn't qiskit appear in ""help(""modules"")"" even though it is installed in python environment?",A workaround to fix this is to manually add the qiskit install location to your python path in the notebook. You can find the path by running pip show qiskit
in a terminal, which will return a field called Location
. In the notebook then add the following lines
import sys
+sys.path.append('the location')
+
+",5955,,,,,3/4/2020 16:06,,,,2,,,,CC BY-SA 4.0
+10091,2,,10077,3/4/2020 17:26,,2,,"Here is an example of creating a doubly controlled version of the simplest circuit with one gate (Qiskit's $u1$ gate).
+ +from qiskit import *
+from qiskit.aqua.utils.controlled_circuit import get_controlled_circuit
+import numpy as np
+
+q_reg = QuantumRegister(3, 'q')
+qc_u1 = QuantumCircuit(q_reg)
+qc_cu1 = QuantumCircuit(q_reg)
+qc_ccu1 = QuantumCircuit(q_reg)
+
+qc_u1.u1(np.pi/2, q_reg[0])
+
+qc_cu1 = get_controlled_circuit(qc_u1, q_reg[1])
+
+qc_ccu1 = get_controlled_circuit(qc_cu1, q_reg[2])
+
+print(qc_cu1.qasm())
+print(qc_ccu1.qasm())
+
+
+And yes, even for this simplest gate, the printed result looks horrible XD (a lot of gates), because it uses generic procedures to create the controlled version of the given circuit. Maybe optimizing the circuit at the end will reduce the gate number and make it a more readable circuit.
+ +Just an answer about the doubly controlled circuit, don't know much about the links and the problem that you have introduced.
+",9459,,9459,,3/4/2020 17:42,3/4/2020 17:42,,,,5,,,,CC BY-SA 4.0 +10092,1,10093,,3/4/2020 18:30,,-1,50,"When you have a quantum circuit and use QuantumCircuit.data you get a list with objects of this type (this is the one for a X gate acting on qubit 0 y a 2 qubits Quantum Circuit):
+ +(qiskit.extensions.standard.x.XGate object at 0x0000019B8DEC2EB8, [Qubit(QuantumRegister(2, 'q'), 0)], [])
+ +The first element represents the operation. What does the sequence of digits 0x0000019B8DEC2EB8 mean? I suppose it has something to do with the location or the time, but I do not know how to obtain each digit. I need to know exactly how to reproduce one of these sequences myself.
+ +Thank you so much in advance.
+",9887,,55,,10/28/2020 9:23,10/28/2020 9:23,What do the numbers of the operation object in QuantumCircuit.data outputs?,That is the address in memory (represented as a hexademical number) of that specific gate object. It can be used to differentiate that specific X gate object from a different X gate object. Other than that it general is not useful, and it's definitely not something you would ever need to manually reproduce.
+",5529,,,,,3/4/2020 19:04,,,,1,,,,CC BY-SA 4.0 +10094,2,,10092,3/4/2020 19:09,,1,,"These numbers are memory addresses of the Gate objects in python. Instances of any python class will have them (though they may not always be shown):
+ +>>> class B():
+... def __init__(self):
+... pass
+...
+>>> B()
+<__main__.B object at 0x106e63d30>
+>>> B()
+<__main__.B object at 0x106e63da0>
+
+
+They don't have any meaning in the context of the QuantumCircuit and they'll essentially be random every time you recreate your circuit. (Really, they shouldn't be included in the display of the Gate object).
+ +Why do you need to know how to reproduce these sequences? There's probably another way to accomplish your goal.
+",10274,,,,,3/4/2020 19:09,,,,1,,,,CC BY-SA 4.0 +10096,1,,,3/4/2020 20:52,,1,48,"I had written earlier to propose an econometric modeling application that may lend itself to a quantum computing approach, and was asking how best to proceed.
+ +The model would be centered around the interdependencies of industries within an economy. This approach, known as input-output economic modeling, is used to quantify the output of an industrial sector given inputs from a another sector. As the inputs/outputs change over time, the result is change in demand, which in turn provides a measure of industrial sector's well-being.
+ +The recent Black Swan event that caused an unimaginable labor crisis for the chief provider of the economy's supply chain, has shed new light on the risk of outsourcing dependency, and the effect on global economics. This is new territory. So, the question becomes: How can we monitor the global industrial interdepencies in a timely fashion to create a valuable commercial early warning system? Given the stochastic nature of the problem, I imagined input-output econometric modeling might provide a leaping off point for an application suited to this new computing approach.
+ +Does this make sense?
+ +Thank you
+ +Rich Z
+",10275,,9006,,3/6/2020 19:23,3/6/2020 19:23,Application Query,You can use D-Wave leap. +It is free for sign up, and you can get trial access time.
+",9563,,,,,3/5/2020 3:46,,,,0,,,,CC BY-SA 4.0 +10098,1,,,3/5/2020 12:54,,7,643,"If a given quantum circuit has $n$ qubit inputs and a certain number of gates, how can we represent the whole circuit in matrix form? Here's an example:
+ + + +I am sorry, I am confused on how to express the circuit above in matrix form. Especially on how I'll be a able to take into consideration the circuit lines affected by a Toffoli gate? How does the matrix representation of the first Toffoli gate (read from left to right) differ to the matrix representation of the second Toffoli gate since they have different control and target lines. Also what's the difference of the matrix representation of the NOT gate applied to the first circuit line to a NOT gate applied to the second line?
+ +Thank you.
+",10282,,55,,3/5/2020 23:07,3/6/2020 11:19,How to represent an $n$-qubit circuit in matrix form?,(This is basically a reference request)
+ +I am wondering if there are any results out there on to what accuracy a given unitary can be approximated with an element drawn from a t-design.
+ +To elaborate a bit, consider the Haar measure over $U(d)$. This integrates over all the unitaries in $U(d)$. So we could say that given some fixed unitary $U_0$, there is an element in the set of unitaries integrated over by the Haar measure which approximates $U_0$ well (this is trivial of course, since $U_0$ itself occurs in the integration).
+ +Now consider a $t$-design. The $t$-design is a finite set of unitaries which has some special properties - namely summing over that set approximates doing a Haar integral. Heuristically, the set of unitaries in the $t$-design looks like the full set of unitaries. So now given some specific unitary $U_0\in U(d)$, is it the case that some element of the $t$-design must be close to $U_0$?
+",8468,,16606,,6/4/2022 12:47,6/4/2022 12:47,Approximating unitaries with elements from a t-design,The overall matrix can be built from the knowledge of the matrices representing each element of the circuit (in your example, the Toffoli and single-qubit gates) by simple matrix multiplication.
+ +To obtain the matrix representation of a Toffoli gate acting between three qubits, a good way to start is by first writing down its bra-ket representation. This amounts to writing down how the gate operates on the various elements of the computational basis. +In this case, this would amount to
+ +To obtain the matrix representation, you now build the matrix whose $p$-th column has a single $1$ at the position $q_p$ (note that the bra-ket representation of the gate is not actually necessary here, it's just a way to write down the action of the gate in a systematic way, but can be skipped once you are familiar with the process).
+ +For example, the action of the first Toffoli gate in your circuit can be written as +$$ + |11100\rangle\!\langle 11000| + |11000\rangle\!\langle 11100| + (\text{identity over all other elements}). +$$ +The matrix representation is then the matrix which only differs from the diagonal by its acting off-diagonally in the positions corresponding to $|11000\rangle$ and $|11100\rangle$. Note that which positions correspond to these states partly depends on the notation you are using. A standard notation is to list computational basis states as if you were counting in binary, so $|00000\rangle\to 0$, $|00001\rangle\to 1,...,|11000\rangle\to 2^4 + 2^3=24$, etc.
+ +This trick will work to find the matrix representation of any gate which acts as a permutation over computational basis elements.
+",55,,,,,3/5/2020 19:19,,,,0,,,,CC BY-SA 4.0 +10101,1,10104,,3/5/2020 20:38,,2,82,"In his essay ""Why now is the right time to study quantum computing"" Aram Harrow writes, after describing the action of the $\sqrt{NOT}$ gate, that:
+ +++ +However, if we apply $\sqrt{NOT}$ a second time before measuring, then we always obtain the outcome 1. This demonstrates a key difference between quantum superpositions and random mixtures; placing a state into a superposition can be done without any irreversible loss of information.
+
I'm confused by what he meant here. How does the existence of a $\sqrt{NOT}$ gate in quantum computation demonstrate a difference in irreversibility as opposed to classical computation?
+",5710,,9006,,3/5/2020 22:16,3/6/2020 0:30,What does the $\sqrt{NOT}$ gate have to do with irreversibility?,He's saying that there is a unitary matrix $U$ (quantum operation) with the property that $U^2$ is a bit flip, but there is no stochastic matrix (random operation) $S$ such that $S^2$ is a bit flip.
+ +In terms of reversibility, the key thing is that the state $U|0\rangle$ is perpendicular to the state $U|1\rangle$ for any $U$. For classical operations that is not always true. For example, for the ""coin flip"" operation $S$ it is the case that $S|0\rangle = S|1\rangle$. This implies that there can be no inverse operation $S^\dagger$ such that $\forall k: S^\dagger S|k\rangle = |k\rangle$.
+",119,,119,,3/5/2020 23:47,3/5/2020 23:47,,,,1,,,,CC BY-SA 4.0 +10103,1,,,3/5/2020 22:55,,4,121,"The Solovay-Kitaev theorem shows that we can approximate arbitrary unitary transformations with polynomially many quantum gates. Can we approximate the resulting state vectors in the same way by specifying the quantum states of pairs (or possibly more) of qubits? I.e. if we have $\psi_{i,j}$ be the approximate state of the qubits $i$ and $j$, is this enough to approximate the entire quantum state?
+ +I wouldn't say it's the existence of the $\sqrt{NOT}$ gate that demonstrates reversibility per se. It's the specific example that Harrow is using.
+ +When you measure the output of applying a $\sqrt{NOT}$ gate to a $|0\rangle$, it looks just like a coin flip. It could be either $|0\rangle$ or $|1\rangle$ with a 50% chance. So far, nothing has been demonstrated that a random mixture can't do. A random mixture is perfectly capable of replacing a single bit with the results of a coin flip.
+ +When you apply $\sqrt{NOT}$ a second time, the $\sqrt{NOT}$ gate recovers the initial information. But recovering information would be impossible if there was simply a random mixture. That's the demonstration of the key difference between superposition and random mixture. Information used in the creation of a superposition can be recovered; information lost in a random mixture cannot be.
+",9995,,,,,3/6/2020 0:23,,,,0,,,,CC BY-SA 4.0 +10105,2,,10101,3/6/2020 0:30,,3,,"The point is just that the gate $U := \sqrt{\rm{NOT}}$ naively appears to to scramble all the information about an initial classical state, because it takes both the initial states $|0\rangle$ and $|1\rangle$ to states that have 50/50 probabilities of being measured to 0 or 1. So classically, one would expect that these superposition states $U|0\rangle$ and $U|1\rangle$ would be identical, and that the procedure that prepared them - applying the gate $U$ to a computational basis state - would have irreversably erased all the information about the initial state. But the secret sauce of quantum coherence - i.e. the different relative complex phases in the amplitudes - means that the apparently-scrambled states $U|0\rangle$ and $U|1\rangle$ are actually physically distinct, and applying the gate $U$ again makes the apparently-erased information ""reappear"" by transforming the apparently-identical states into manifestly distinct states. The point is that unitary operations like $U$ never actually destroy any information about the initial state, even if they might naively appear to.
+",551,,,,,3/6/2020 0:30,,,,0,,,,CC BY-SA 4.0 +10106,2,,10098,3/6/2020 11:04,,4,,"As mentioned in answer by qIS, you should decompose the circuit to steps. In case no gate is applied in the circuit, you have to replace this empty place with identity operator $I$ acting on one qubit.
+ +Note, that symbol $CCNOT$ is used for Toffoli gate.
+ +Here are matrices describing each step:
+ +The last step to obtain matrix desribing whole circuit is to do matrix multiplication $S_{6}S_{5}S_{4}S_{3}S_{2}S_{1}$.
+ +Matrix $CCNOT_{1,2 \rightarrow 4}$:
+ + +",9006,,9006,,3/6/2020 11:19,3/6/2020 11:19,,,,0,,,,CC BY-SA 4.0 +10107,1,10108,,3/6/2020 11:54,,2,137,"I am running vqe algorithm in qasm_simulator and cannot get the optimal solution. +Are there any methods for finding the optimal value of depth for variational form and max_iter for optimizer parameters? What exactly does the depth parameter?
+",10234,,,,,3/6/2020 13:45,Finding optimal values of depth and max_trials parameters in vqe algorithm,Depth is the number of repetitions of the basic circuit of the variational form. By adding more repetitions the expectation is that it can cover a larger part of the Hilbert space and hopefully include the solution space that a shallower one could not. Now each basic circuit has parameters so it can be varied. Adding more repetitions adds more parameters and results in a larger parameter space for the optimization which thus can get more difficult for the optimizer as it increases.
+ +max_trials is used by SPSA that you are using. You may need to increase this number to allow the optimizer enough to find a minimum. SPSA will always go to that limit before returning.
+ +I take it the solution is found ok on a state_vector simulator, its just when you try qasm simulator that you are having difficulty finding the solution.
+",9831,,,,,3/6/2020 13:45,,,,1,,,,CC BY-SA 4.0 +10109,1,10124,,3/6/2020 23:08,,2,507,"I am trying to wrap my head around he quantum_info
module on qiskit, since most of the functions on qiskit.tools
are going to be deprecated, but I am very confused with the Statevector and DensityMatrix objects. For example, with this snippet of code:
simulator = BasicAer.get_backend('statevector_simulator') # the device to run on
+result6 = execute(circuit6, simulator).result()
+outputstate6 = result6.get_statevector(circuit6, decimals=3)
+probability = np.abs(np.array(outputstate6))**2
+outstatevector=quantum_info.states.Statevector(outputstate6)
+print(type(outstatevector))
+print(type(outputstate6))
+print(outputstate6)
+print(quantum_info.entropy(outputstate6))
+
+
+I get:
+ +<class 'qiskit.quantum_info.states.statevector.Statevector'>
+<class 'numpy.ndarray'>
+[0.447+0.j 0. +0.j 0.632+0.j 0.632+0.j]
+
+
+as expected but then I get the error on quantum_info.entropy(outputstate6)
:
QiskitError: 'Input quantum state is not a valid'
+
+
+How can I solve this?
+",5620,,55,,10/28/2020 9:22,10/28/2020 9:22,How to calculate the Von Neuman entropy on qiskit with the module quantum_info?,I have a quick question: Is the qubit state $|\psi\rangle$ the same as $-|\psi\rangle$?
+",9835,,2879,,3/7/2020 8:12,3/13/2020 18:47,Negative of a qubit state,Yes.
+ +The factor $e^{i\phi}$ of the state $e^{i\phi}|\psi\rangle$ (which in this case is $-1$) is called a ""global phase"". It does not have physically observable consequences (i.e., you can not come up with an experiment to figure out what the global phase of a state is) and can be safely ignored.
+",2879,,,,,3/7/2020 7:34,,,,0,,,,CC BY-SA 4.0 +10112,2,,10110,3/7/2020 7:36,,9,,"States $|\psi\rangle$ and $-|\psi\rangle$ differ in global phase only and thus they are indistinguishable. So, the answer is: state $-|\psi\rangle$ is the equivalent to $|\psi\rangle$.
+ +The global phase in this case is $\pi$ because $\mathrm{e}^{i\pi} = -1$.
+",9006,,9006,,3/13/2020 18:47,3/13/2020 18:47,,,,6,,,,CC BY-SA 4.0 +10113,2,,10110,3/7/2020 8:43,,7,,"They are physically indistinguishable, also their density matrices are the same because $$\big(-|\psi\rangle\big)\big(-\langle\psi|\big) = |\psi\rangle \langle\psi|$$ +But mathematically they are two different vectors. And it's better to not forget about this when doing calculations.
+",5870,,,,,3/7/2020 8:43,,,,1,,,,CC BY-SA 4.0 +10115,1,10117,,3/7/2020 19:48,,3,1589,"The question is quite straightforward, I have some two qubit state and I want to measure it in the Bell basis. This question answers me partly, but I still have some doubts because, I thought that just reversing back the transformation would give me the desired mapping from:
+ +$$ +|\Phi^+\rangle \to |00\rangle \\ +|\Phi^-\rangle \to |01\rangle \\ +|\Psi^+\rangle \to |10\rangle \\ +|\Psi^+\rangle \to |11\rangle \\ +$$
+ +but it does't seem to work as I thought it would:
+ + + +By doing the math I understand that it should give this, but what I don't understand is my reasoning to why it is so. That is, why was I wrong thinking that the above circuit would return all the measurements in the $|00\rangle$?
+",5620,,,,,3/8/2020 22:40,How to measure in the bell basis?,I understand that given a pure state $ |\psi\rangle$, we can express it in terms of two angles $\theta$ and $\varphi$ such that $|\psi\rangle = \cos(\theta/2)|0\rangle + \mathrm{e}^{i\varphi}\sin(\theta/2)|1\rangle $, and this is derived by converting from $|\psi\rangle = \alpha|0\rangle + \beta|1\rangle$ into their representations in terms of $r\mathrm{e}^{i\theta}$, and then factoring and rearranging that.
+ +But how do I convert between the two representations given arbitrary states? I know that $|0\rangle = (\theta,\varphi) = (0,0), |1\rangle = (\pi,0), |+\rangle = (\pi/2, 0)$ etc, but how do I get it for an arbitrary state $|\psi\rangle$?
+ +So far, I have:
+ +$$ +\theta = 2 \arccos(\alpha\bar\alpha) \\ +\varphi = ??? +$$
+",10304,,55,,11/13/2021 1:42,11/13/2021 1:42,How to get the Bloch sphere angles given an arbitrary qubit?,I have found my mistake, and hopefully it may help more people. It lies on the fact that $(AB)^\dagger=B^\dagger A^\dagger$. Having done so, my result is as expected. But any more enlightening answer is more than welcome.
+",5620,,,,,3/7/2020 20:08,,,,0,,,,CC BY-SA 4.0 +10118,2,,10115,3/7/2020 23:38,,1,,"Generally, if you want to inverse a quantum algorithm you simply read it from other side and replace all quantum gates with their inverses, i.e. conjugate transposed operators.
+ +So, if your original algorithm is described by series of gates $A_{n}A_{n-1}\dots A_2A_1$, the inverse algorithm is $A_{1}^\dagger A_{2}^\dagger \dots A_{n-1} ^\dagger A_{n} ^\dagger $.
+ +In your case, you use an algorithm $CNOT(H\otimes I)$ for transforming initial state to Bell state. So, to measure in Bell basis you have to applied inverse $(H^\dagger\otimes I^\dagger)CNOT^\dagger = (H\otimes I)CNOT$ because $I^\dagger=I$, $H^\dagger = H$ and $CNOT^\dagger = CNOT$.
+ +Added by Davit Khachatryan:
+ +Also, if one has an arbitrary quantum state in the Bell basis:
+ +$$ +|\psi \rangle = c_{\Phi^+}|\Phi^+\rangle + c_{\Phi^-}|\Phi^-\rangle + c_{\Psi^+}|\Psi^+\rangle + c_{\Psi^-}|\Psi^-\rangle +$$
+ +where $c_{\Phi^+}$, $c_{\Phi^-}$, $c_{\Psi^+}$ and $c_{\Psi^-}$ are the corresponding aplitudes in the Bell basis. After applying $(H\otimes I)CNOT$ we will have:
+ +$$ +|\psi \rangle = c_{\Phi^+}|00\rangle + c_{\Phi^-}|10\rangle + c_{\Psi^+}|01\rangle + c_{\Psi^-}|11\rangle +$$
+ +Note that $c$ coefficients that were in correspondence with Bell states now correspond to the computational states. So, this is letting us have the mapping from Bell states to computational states.
+",9006,,9459,,3/8/2020 22:40,3/8/2020 22:40,,,,0,,,,CC BY-SA 4.0 +10119,1,,,3/8/2020 0:47,,1,104,"I implemented a solver for the Job Shop Problem, based on quantum annealing, on a D-Wave machine.
+ +I have a problem, that even though minimal energy solutions exist, they are only chosen once. I set the nbr of reads to 1000, but the responses still look like this:
+ +0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ... 41 energy num_oc. ...
+0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 ... 1 -144.0 1 ...
+1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 ... 1 -136.0 1 ...
+2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 ... 1 -134.0 1 ...
+15 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 ... 0 -133.0 1 ...
+16 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0 -133.0 1 ...
+138 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 ... 0 -131.0 1 ...
+3 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 ... 1 -129.0 1 ...
+4 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 ... 0 -127.0 1 ...
+
+
+Should't the lowest energy solution, get picked more than once, just by chance?
+ +On multiple runs, I now always get a different, kind of random result it seems.
+ +I tried playing around with the chain strength, up to a point where no chains are breaking anymore, so I think it should be at a good spot right now.
+ +Do you have any idea, what the issue might be?
+",9950,,,,,3/8/2020 17:34,Quantum Annealing - Random results on big N,I am trying to understand the random quantum circuit sampling arguments for recent Google experiment, but struggling to understand why there exists a family of quantum circuit whose output distribution is #P-hard to calculate exactly. Papers in this topics just show how to reduce average case random circuit sampling to exact random circuit sampling, but does not provides details of the #P-hardness of exact quantum circuit sampling. Could anybody provide detailed arguments for the fact that there exists a family of quantum circuit whose output distribution is #P-hard to calculate exactly?
+ +Thanks.
+",10307,,,,,3/8/2020 5:57,How do we know that there exists a quantum circuit whose output distribution is #P-hard to calculate?,Given some partial states $\rho_{AB}$ and $\sigma_{AC}$, is there a general procedure to construct a state $\delta_{ABC}$ such that the following sum of trace distances
+ +$$||\text{Tr}_C(\delta_{ABC}) - \rho_{AB}||_1 + ||\text{Tr}_B(\delta_{ABC}) - \sigma_{AC}||_1$$
+ +is minimal? That is we want a joint state that under partial traces is as close as possible to some given targets. In particular, when there is entanglement in both $AB$ and $AC$, I'm not sure how to proceed.
+",4831,,,,,3/9/2020 14:13,"Given partial states, can one construct the best estimate of the full state?",As in if given $ |\psi\rangle=\alpha |0\rangle+\beta |1\rangle$, and you want it in the form $\cos(\theta/2) |0\rangle+e^{i\phi}\sin(\theta/2) |1\rangle$?
+ +Assume the state is normalised $|\alpha|^2+|\beta|^2=1$.
+ +I'd first start by multiplying by $\frac{\alpha^*}{|\alpha|}$ which is a phase (complex number unit length), and use $\alpha \alpha^*=|\alpha|^2$.
+ +$$\frac{\alpha^*}{|\alpha|}|\psi\rangle=|\alpha| |0\rangle+\frac{\beta\alpha^*}{|\alpha|}|1\rangle =\cos(\theta/2) |0\rangle+e^{i\phi}\sin(\theta/2) |1\rangle$$
+ +So $\theta=2\arccos(|\alpha|)$ or $\theta=2\arcsin(|\beta|)$.
+ +Then $\frac{\beta\alpha^*}{|\alpha|}=e^{i\phi}|\beta|$ or $\frac{\beta\alpha^*}{|\alpha||\beta|}=e^{i\phi}$,
+ +so that $\phi=\arg\left(\frac{\beta\alpha^*}{|\alpha||\beta|}\right)$ and it depends on how you want to calculate that, which branch of the loagarithm to take/where to measure angles from.
+ +You could do something like $\phi=-i\ln\left(\frac{\beta\alpha^*}{|\alpha||\beta|}\right)$ etc.
+ +In summary try
+ +$$ +\theta = 2 \arccos(|\alpha|) \\ +\varphi = \arg\left(\frac{\beta\alpha^*}{|\alpha||\beta|}\right) +$$
+",197,,,,,3/8/2020 15:09,,,,2,,,,CC BY-SA 4.0 +10123,1,,,3/8/2020 15:18,,3,89,"I would like to understand why two qubit gates are generally more noisy.
+ +If I am interested in single qubit gates, I can have an effective modelling as a master equation:
+ +$$\dot{\rho}=\frac{1}{i \hbar} [H,\rho]+\gamma \mathcal{D}[\sigma_-] \rho +\gamma^* \mathcal{D}[\sigma_z] \rho$$
+ +The rate of noise is roughly: $\gamma+\gamma^*$
+ +With $H=\frac{\hbar \Omega}{2} \sigma_y $ for a $y$ rotation in the interaction picture.
+ +For a two qubit gate, I would expect a simple model like:
+ +$$\dot{\rho}=\frac{1}{i \hbar} [H,\rho]+\gamma \left(\mathcal{D}[\sigma^1_-]+\mathcal{D}[\sigma^2_-]\right) \rho +\gamma^* \left( \mathcal{D}[\sigma^1_z] + \mathcal{D}[\sigma^2_z]\right) \rho$$
+ +With $H=\frac{\hbar g}{2} \left( \sigma_1^+ \sigma_2^-+\sigma_1^- \sigma_2^+ \right)$
+ +My question is:
+ +Why are two qubit gates generally noisier ?
+ +Indeed here with this simple model I would expect the rate noise to simply be $2(\gamma+\gamma^*)$. Thus twice as the one for the single qubit gate. But at the same time we have two qubits so ""per qubit"" the rate of noise is the same.
+ +Are two qubits gate noisier because they rotate slower ?
+ +I would like a justified answer (with references) in the context of superconducting qubits.
+",5008,,,,,3/8/2020 15:18,Why are two qubits gates more noisy?,Short answer
+ +You are getting that error because your example does not use a valid (normalized) statevector. If you remove the decimals=3
kwarg where you call result.get_statevector
it will work.
Long Answer
+ +The Von-Neuman entropy
function in the qiskit.quantum_info
works with either Statevector
or DensityMatrix
object inputs, or inputs that can be implicitly converted to those objects (ie a list or np.array for a vector or a square matrix). So you can do any of the following for example:
import numpy as np
+from qiskit.quantum_info import entropy, Statevector, DensityMatrix
+
+# Pure state entropy (Note this is always 0)
+# The following are equivalent:
+
+s1 = entropy([1, 0, 0, 0]) # Statevector as list
+s2 = entropy(np.array([1, 0, 0, 0])) # Statevector as array
+s3 = entropy(Statevector([1, 0, 0, 0])) # Statevector object
+
+print(s1, s2, s3)
+
+# Mixed state entropy
+# The following are equivalent
+
+s1 = entropy([[0.75, 0], [0, 0.25]]) # Density matrix as list
+s2 = entropy(np.array([[0.75, 0], [0, 0.25]])) # density matrix as array
+s3 = entropy(DensityMatrix([[0.75, 0], [0, 0.25]])) # Density matrix object
+
+print(s1, s2, s3)
+
+
+As for your specific issue: the entropy is only well-defined for a valid quantum state, so the function checks the input state is valid. In the case of a statevector this is checking it has norm 1, in the case of a density matrix that it is trace 1 and postive-semidefinite.
+ +Your example does not have a norm-1 input state because you truncated the decimals when you got the output state from the simulator. You can check this using the statevector object for example:
+ +# Returns True:
+Statevector([1 / np.sqrt(2), 1 / np.sqrt(2)]).is_valid()
+
+# Returns False:
+Statevector([0.707, 0.707]).is_valid()
+
+
+Entropy base: Another thing you should keep in mind if you didn't already notice is that the qiskit.quantum_info.entropy
function takes logarithms in base 2 by default (and you can use a different base using the base
kwarg). The deprecated qiskit.tools.qi.entropy
function was always taken in log base e
:
import numpy as np
+from qiskit.quantum_info import entropy
+from qiskit.tools.qi import entropy as old_entropy
+
+rho = [[0.75, 0], [0, 0.25]]
+
+s1 = entropy(rho) # base-2
+s2 = entropy(rho, base=np.e) # base-e
+s3 = old_entropy(rho) # base-e
+
+print(s1, s2, s3, s2 == s3)
+```
+
+",8650,,,,,3/8/2020 15:58,,,,0,,,,CC BY-SA 4.0
+10125,2,,10119,3/8/2020 17:34,,1,,"There is no guarantee the lowest energy solution get picked more often, or even get picked once.
+ +Many parameters may be tweaked in order to improve your results. I am not sure if you are running time parameters by default but you may tweak more the times (like longer annealing time...).
+ +Secondly, it may be the case that this problem corresponds to a hard one for the annealer (requires too many qubits when embedding your problem, or/and that this problem has a minimal spectral gap very small where it is more for quantum annealing...). Maybe what you could do is try fixing a few variables from the exact solution, and see if you still miss too often the exact solution. You may also have mistakes when setting your problem as a QUBO, which I would recommend debugging it well in order to be sure.
+ +Finally, you may try a good classical heuristic for this problem and check you find a good solution, and see if the annealer improves against it.
+",4127,,,,,3/8/2020 17:34,,,,7,,,,CC BY-SA 4.0 +10126,1,,,3/8/2020 21:30,,5,449,"Let $|\Omega \rangle$ be the maximally entangled state over a bipartite system whose parts are each dimension $d$, i.e. +$$ +| \Omega \rangle \equiv \sum_i^{d}| ii \rangle +$$
+ +Then one way of writing the Choi representation $J(\Phi)$ of a channel $\Phi: \mathbb{C}^{d\times d} \rightarrow \mathbb{C}^{d\times d}$ that acts on density operators $\rho \in \mathbb{C}^{d \times d}$ is: +$$ +J(\Phi) \equiv (I \otimes \Phi )| \Omega \rangle \langle \Omega | +$$
+ +If I choose $\Phi_U$ to be a unitary channel (i.e. $\Phi_U (\rho ) = U\rho U^\dagger$) then its Choi representation in this notation would be: +$$ +J(\Phi_U) \equiv (I \otimes U)| \Omega \rangle \langle \Omega |(I \otimes U^\dagger) +$$
+ +My question is, is there an explicit way to represent compositions of unitaries in terms of the unitaries' respective Choi representations? In other words, if $\Phi_{U\circ V}(\rho) \equiv UV\rho (UV)^\dagger$, how can I ""nicely"" represent $J(\Phi_{U \circ V})$, for example in terms of $J(\Phi_U)$ and $J(\Phi_V)$ and linear operations in $\mathbb{C}^{d^2 \times d^2}$?
+",1939,,55,,9/3/2020 15:03,11/11/2020 14:36,Explicit form for composition of Choi representation quantum channels,Again, I am new to quantum computing and have a CS background, so apologies if this seems like an obvious question or if I seem unclear. $\newcommand{\braket}[1]{\langle #1 \rangle}\newcommand{\bra}[1]{\langle #1 |}\newcommand{\ket}[1]{| #1 \rangle}$
+ +Let $U_l = \text{exp}(i\frac{\pi}{4}l(z)X)$ where $X$ is the pauli $\sigma_x$ gate and $l(z)$ is either $+1$ or $-1$
+ +The paper that I've been reading claims that $$U_l^{\dagger}YU_l = \cos(\frac{\pi}{2}l(z))Y + \sin(\frac{\pi}{2}l(z))Z$$ where $Y$ is the pauli $\sigma_{y}$ gate and $Z$ is $\sigma_z$
+ +Finally, they conclude that $$\bra{z,0}U_l^{\dagger}YU_l\ket{z,0} = \sin(\frac{\pi}{2}l(z)) = l(z)$$ , where $z = z_1,...,z_n$
+ +When I try this myself, I don't get the same result and I am not able to spot my mistake. Here's my approach:
+ +$U_l = \text{exp}(i\frac{\pi}{4}l(z)X) = I + e^{i\frac{\pi}{4}l(z)}X$ where $I$ is the identity matrix
+ +Thus, I have that $$U_l^{\dagger}Y = Y + ie^{-i\frac{\pi}{4}l(z)}Z$$ and therefore $$U_l^{\dagger}YU_l = -ie^{i\frac{\pi}{4}l(z)}Z + ie^{-i\frac{\pi}{4}l(z)}Z$$ which, when we apply Euler's formula, reduces to: $$2\sin(\frac{\pi}{4}l(z))Z$$ which doesn't seem to be correct.
+ +Could you please help me out? I've been stuck on it for a couple of days now.
+",9407,,2149,,3/9/2020 22:34,3/10/2020 7:44,Similarity Transformations on Pauli Operators in 2-qubit states (eq. 11 - Farhi's QNN Paper),I know there is a documentation for qiskit.aqua.algorithms.Shor that explains that they used this reference for implementing the actual circuit. It says that the number of qubit needed is 2n+3. So to factor N=15, 11 qubits would be needed. I decided to test this using Qiskit with a backend that has up to 15 qubits. But then I get an error saying that I needed 18 qubits to factor N = 15. Is the implementation different from the actual paper referenced? or am I missing something ?
+ +This is the code I used to factor N=15
+ +shor = Shor(15,2)
+backend = provider.get_backend('ibmq_16_melbourne')
+quantum_instance = QuantumInstance(backend, skip_qobj_validation=False)
+res = shor.run(quantum_instance)
+print(""The list of factors of {} as computed by Shor is {}."".format(PRIME, res['factors'][0]))
+
+
+And this is the error i got
+ +TranspilerError: 'Number of qubits (18) in circuit1 is greater than maximum (15) in the coupling_TranspilerError: 'Number of qubits (18) in circuit1 is greater than maximum (15) in the coupling_map'
+
+",10280,,4127,,3/9/2020 7:04,3/9/2020 12:30,How many Qubits does the qiskit implementation of Shor's Algorithm need to factor N=15?,Your assumption that
+ +$$U_l = \text{exp}(i\frac{\pi}{4}l(z)X_{n+1}) = I_{n+1} + e^{i\frac{\pi}{4}l(z)}X_{n+1}$$
+ +is invalid. When an operator is in the exponent, it is defined by the power series about $X = 0$ with the operator replaced in the exponential by the eigenvalue. In this case
+ +$$U_l = 1 + i\frac{\pi}{4}l(z) e^{i\frac{\pi}{4}l(z)x}X_{n+1} - \frac{1}{2!}\frac{\pi^2}{16}l^2(z) e^{i\frac{\pi}{4}l(z)x}X_{n+1}X_{n+1} + ...$$
+ +Recalling that the pauli matrices square to the identity matrix, you can see that +$$e^{i\theta X} = \cos(\theta) I + i\sin(\theta)X$$ in a totally analogous way to the proof of euler's formula by power series. Which is derivation of the accepted answers starting point.
+ +In the generic case where such a simplification was not available:
+ +The easiest way to find $U^{\dagger} Y U$ would be by recalling
+ +$$ U^{\dagger} Y U = U^{\dagger} (U Y) + U^{\dagger} [Y, U] = Y + U^{\dagger} [Y, U]$$
+ +Then you would need to find the commutator $[Y,U]$. You could either insert the expansion above in for $U$ and use the linearity of the commutator to work that out, or you could use a form of the use Baker-Campbell-Hausdorf formula (line 2 in the link):
+ +$$e^{-A}Be^{A} = B + [A,B] + \frac{1}{2!}[A,[A,B]] + \frac{1}{3!}[A,[A,[A,B]]] + ...$$
+ +Perhaps someone else can come give a more complete answer that works through the algebra, but, if you were to plug in the Pauli commutation relations and collect terms with $Y$ and $Z$ separately, you would get the expansion for $\cos(\frac{\pi}{2} l(z))$ in front of the terms with $Y$ and $\sin(\frac{\pi}{2} l(z))$ in front of $[X,Y] \propto Z$.
+ +Here's a worked example of using the BCH formula for computing $[x,e^{ixp}]$.
+",2149,,2149,,3/9/2020 21:49,3/9/2020 21:49,,,,2,,,,CC BY-SA 4.0 +10130,2,,10127,3/9/2020 7:47,,3,,"By taking into account the Euler-like formula for Pauli matrices (see, for example, the formula (4.4) or (4.7) in the M. Nielson and I. Chuang textbook):
+ +$$e^{i \theta X} = cos(\theta)I + i sin(\theta) X$$
+ +We can show that:
+ +$$U_l = e^{i \frac{\pi}{4}l(z) X} = cos(\frac{\pi}{4}l(z)) I + isin(\frac{\pi}{4}l(z)) X$$
+ +So
+ +\begin{align*} +U_l^\dagger Y U_l &= \left( cos(\frac{\pi}{4}l(z)) I - isin(\frac{\pi}{4}l(z)) +X \right) +Y \left( cos(\frac{\pi}{4}l(z)) I + i sin(\frac{\pi}{4}l(z)) X \right) = +\\ +&= cos^2(\frac{\pi}{4}l(z))Y + \frac{1}{2}sin(\frac{\pi}{2}l(z)) Z + \frac{1}{2}sin(\frac{\pi}{2}l(z))Z - sin^2(\frac{\pi}{4}l(z))Y = +\\ +&= cos(\frac{\pi}{2}l(z))Y + sin(\frac{\pi}{2}l(z)) Z +\end{align*}
+ +Also, I am not certain what $\left|z,0\right\rangle$ means, but note that:
+ +\begin{align*} +\langle 0| U_l^\dagger Y U_l | 0 \rangle = cos(\frac{\pi}{2}l(z)) \langle 0 | Y | 0 \rangle + sin(\frac{\pi}{2}l(z)) \langle 0 | Z |0 \rangle = sin(\frac{\pi}{2}l(z)) +\end{align*}
+ +An example of ""bra-ket"" calculation:
+ +$$ +\langle 0 | Y | 0 \rangle = +\begin{pmatrix} +1 & 0 +\end{pmatrix} +\begin{pmatrix} +0 & -i \\ +i & 0 +\end{pmatrix} +\begin{pmatrix} +1 \\ +0 +\end{pmatrix} = 0 +$$
+",9459,,9459,,3/10/2020 7:44,3/10/2020 7:44,,,,3,,,,CC BY-SA 4.0 +10131,2,,10121,3/9/2020 9:40,,1,,"I would probably set this up as a semi-definite program and throw it at the computer. Basically, your problem is a linear problem in the coefficients of the matrix $\delta_{ABC}$ except for the constraint that $\delta_{ABC}$ is positive semi-definite. This is exactly what semi-definite programming is designed to do.
+ +Note: the calculation below uses a different 1-norm (my bad). See the comment by Norbert, below.
+ +It's a bit of a pain to set it all up in the right way (which is why I'm not directly stating the full formula!). You need to do things like let +$$ +M1=\text{Tr}_C(\delta_{ABC})-\rho_{AB} +$$ +and the define variables $x_{ij}$ such that +$$ +M1_{ij}\leq x_{ij},\qquad -M1_{ij}\leq x_{ij} +$$ +with the intent of getting (when we're minimising $x_{ij}$) $x_{ij}=|M1_{ij}|$. Then, you set +$$ +\sum_{j}x_{ij}\leq x\qquad\forall i. +$$ +In effect, $x=\|M_1\|_1$. +If you do something similar with a matrix $M2$, variables $y_{ij}$ and $y$, your final problem is to minimise $x+y$.
+ +Don't forget to include the constraint $\text{Tr}(\rho_{ABC})=1$. It might be implicit in previous constraints, I'm not sure.
+",1837,,1837,,3/9/2020 14:13,3/9/2020 14:13,,,,5,,,,CC BY-SA 4.0 +10132,2,,6821,3/9/2020 9:44,,0,,"If one of them $(U)$ is a unitary while the other one $(V)$ is any matrix (with $\| V \| = 1$), then + I think that
+ +$$f = - tr((U - V)^{\dagger}(U - V))$$ would work well.
+ +For example, if
+ +and so on.
+",462,,462,,3/9/2020 9:54,3/9/2020 9:54,,,,0,,,,CC BY-SA 4.0 +10133,2,,10126,3/9/2020 9:46,,3,,"I'm not an expert on this, so there could easily be other ways (I get the impression you'd like to keep it to a $d^2$ dimensional calculation, where I'm taking it up to $d^4$), but what I'd do is calculate: +$$ +J(\Phi_{U\circ V})=\left(I_d\otimes \langle\Omega|\otimes I_d\right)\left(J(\Phi_V)\otimes J(\Phi_U)\right)\left(I_d\otimes |\Omega\rangle\otimes I_d\right). +$$ +I simply think of this as teleporting the output from the first channel ($V$) into the into of the second channel ($U$) so that you get the composite action of $UV$.
+",1837,,1837,,3/9/2020 16:21,3/9/2020 16:21,,,,2,,,,CC BY-SA 4.0 +10134,1,,,3/9/2020 10:01,,5,622,"Suppose we have an oracle $O_f$ that given an initial state $|x\rangle$ maps it into the following state:
+$$
+O_f : |x\rangle \mapsto e^{if(x)} |x\rangle
+$$
+Now, assuming that $f(x) \in [0,1]$, is it possible to construct a quantum circuit $O_p$ such that:
+$$
+O_p : |x\rangle \otimes |0\rangle \mapsto |x\rangle \otimes (\sqrt{f(x)} |0\rangle + \sqrt{1-f(x)} |1\rangle)
+$$
+using $O_f$ ? If you can suggest some references, i would appreciate it. Thank you very much.
I think that
+ +$$f = \frac{tr(A^{\dagger}B)}{\sqrt{tr(A^{\dagger}A)}\sqrt{tr(B^{\dagger}B)}} $$ is a good useful measure.
+ +Lets say $B = e^{i \phi} A$, then +$tr(A^{\dagger}B) = N e^{i \phi} tr(A^{\dagger}A)$ and $tr(B^{\dagger}B) = tr(A^{\dagger}A)$, thus $f = N e^{i \phi}$
+ +Also, this measure reduces to the Hilbert Schmidt norm when used for Unitary matrices.
+",462,,,,,3/9/2020 10:10,,,,0,,,,CC BY-SA 4.0 +10136,2,,10134,3/9/2020 10:55,,5,,"As a bare minimum, you would need access to a controlled version of your oracle. This cannot be created from the oracle itself (I'm sure there's already an SE question about this part, but cannot immediately lay my hands on it).
+ +A typical construction would allow you to create (Hadamard - controlled oracle - Hadamard) would create an output +$$ +\cos\frac{f(x)}{2}|0\rangle+i\sin\frac{f(x)}{2}|1\rangle, +$$ +which is obviously not what you're asking for. There might be some simple modifications that let you approximate what you're after.
+ +To get what you're actually asking for, I suspect you have to do some quite sophisticated stuff. Essentially, perform phase estimation to estimate the value of $f(x)$ onto a second register, and use that register as a control to produce the state you want, with an accuracy defined by the size of the register.
+",1837,,,,,3/9/2020 10:55,,,,5,,,,CC BY-SA 4.0 +10137,1,10138,,3/9/2020 12:06,,1,70,"In his lecture on quantum computing, Scott Aaronson describes polynomial-size quantum circuits,
+ +++ +Now, once we fix a universal set (any universal set) of quantum gates, we'll be interested in those circuits consisting of at most p(n) gates from our set, where p is a polynomial, and n is the number of bits of the problem instance we want to solve. We call these the polynomial-size quantum circuits.
+
and then using this goes on to give a practical definition of $\sf BQP$:
+ +++ +$\sf BQP$ is the class of languages $L\subseteq\{0, 1\}^*$ for which there exists a uniform family of polynomial-size quantum circuits, $\{C_n\}$, such that for all $x\in\{0, 1\}^n$:
+ ++
+- If $x\in L$ then $C_n$ accepts input $|x\rangle|0\cdots0\rangle$ with probability at least 2/3.
+- If $x\notin L$ then $C_n$ accepts input $|x\rangle|0\cdots0\rangle$ with probability at most 1/3.
+
Now, take $G$ to be any standard universal gate set (e.g. the Clifford+$\rm T$ set), and let $L$ be a language that can be computed on $n$ qubits only by using (polynomially many copies of) some general $SU(2^n)$ gate $\rm U$, whose decomposition requires exponentially (in $n$) many gates from the set $G$. Seemingly $L\notin\sf BQP$ as the circuit implementing $\rm U$ is not a polynomial circuit.
+ +Then, let $G'=G\cup\{\rm U\}$. Clearly, $G'$ is still a universal gate set. However, computing $L$ requires polynomially many gates from $G'$, which would indicate $L\in\sf BQP$.
+ +This seems like a contradiction. Or more profoundly, the definition of $\sf BQP$ seems to depend on the choice of the gate set. What exactly is going wrong here? And is $L$ an element of $\sf BQP$ or not?
+",2687,,2687,,3/11/2020 9:42,3/11/2020 9:42,$\sf BQP$ and general $\mathrm{SU}(2^n)$ gates,I think the issue here is that you've got to be careful with families of circuits. If you're picking a single fixed gate from $SU(2^k)$ for some $k$, then that doesn't necessarily help you with $L$ for $n>k$.
+ +On the other hand, if you implicitly assumed that you had the circuit from $SU(2^n)$ for all $n$, then you're in contradiction with the definition of the universal set (or should be; the notion isn't defined very carefully): that the set be finite (or, at least, that's the easiest clarification, even if it's not quite true. You could still allow an infinite set of gates if it's, for example, single qubit gates depending on a continuous parameter).
+",1837,,,,,3/9/2020 12:22,,,,1,,,,CC BY-SA 4.0 +10139,2,,10128,3/9/2020 12:30,,3,,"Well actually when looking at the source code, the construct_circuit method:
+ +++ +quantum register where the sequential QFT is performed
+ ++self._up_qreg = QuantumRegister(2 * self._n, name='up') + # quantum register where the multiplications are made + self._down_qreg = QuantumRegister(self._n, name='down') + # auxiliary quantum register used in addition and multiplication + self._aux_qreg = QuantumRegister(self._n + 2, name='aux') +
They use indeed $4n + 2$ qubits, so it seems they changed what was proposed in the paper. Some parts were simplified. Check the docstring in the original github repo.
+",4127,,,,,3/9/2020 12:30,,,,1,,,,CC BY-SA 4.0 +10140,2,,10127,3/9/2020 16:42,,2,,"I see this question and realize you too went through Farhi's paper on Quantun Neural Networks! I encountered this paper when I was applying for the Residency at X and was given this to implement - the other paper, by the way, was the seminal QAOA paper. I spent a lot of time head scratching so I can see the why of this question !
+ +I know this is not quite an answer, but what I can provide is a colab notebook I did of the paper to illustrate it. I developed from scratch using a toy model to illustrate how and why the label is well defined on that boundary and how SGD can be used to systematically find one of the two states for the readout bit. Feel free to comment on it and provide feedback. It is supposed to be a pedagogical notebook so if there's a lot unclear on it, please let me know! I really would appreciate it.
+ +I hope it is as helpful as it was for me to develop it!
+ +https://colab.research.google.com/drive/13vxrg483JYVOCywA1xpYnyYnFwoViOEL#scrollTo=qjRWSk6BThju
+",6253,,6253,,3/9/2020 16:48,3/9/2020 16:48,,,,1,,,,CC BY-SA 4.0 +10141,1,,,3/9/2020 17:16,,2,85,"I know this perhaps not a suitable topic for this SE - after all, this is about QC knowledge sharing - but I am wondering if this could be a resource for people who are interested in the field, are currently enrolled in college - undergrad and beyond - and would like to know the best way - for their current station in the physics/QC track/journey - to approach/pursue the many opportunities there are out there.
+ +I really hope the community takes upon this question and this becomes a wiki for people to come and see the feedback from the community to be better prepared to compete for those learning opportunity - specially the internships, which as far as I know, are not that many.
+",6253,,55,,10/28/2020 9:22,10/28/2020 9:22,Guide for Quantum Information and Computing Internships and Learning Opportunities,What is the best mathematical representation of a quantum system that has some classical registers and some quantum registers?
+ +I'm asking because I'm considering any ""physical"" process $\pi()$ that takes no input, but that outputs both classical and quantum values, like for example a tuple $(x, \rho)$, with $x \in \{0,1\}^n$ a classical string, and $\rho$ a quantum state on $m$ qubits, and I'd like to find a kind of Kraus representation of $\pi$.
+ +I wanted to use the usual formalism of CPTP, but it's not clear in which Hilbert space lives $(x, \rho)$... Indeed, usually, a Hilbert space is stable by superposition, but here the first ""register"" cannot be in superposition. Of course, I could say that $x$ is in fact $|x\rangle$ and therefore the output of $\pi()$ is strictly contained in a Hilbert space of size $2^n$, but then $\pi()$ is not simply $\sigma = \sum_i B_i 1 B_i^\dagger$, as I'd also need to ""measure"" $\sigma$ to extract a random $x$, and then set $\rho$ to be the matrix $\sigma$ ""postselected"" on $x$.
+ +Is there some better representation for such process that makes the difference between quantum outputs and classical outputs?
+",5969,,9006,,3/10/2020 5:12,3/10/2020 5:12,"CPTP, Kraus representation and classical registers",CPTP map is a map from operators on one Hilbert space to operators on another Hilbert space (usually we consider only density matrices as inputs and outputs). There are no separated classical registers in this formalism.
+There are some generalizations, though, like this https://en.wikipedia.org/wiki/Quantum_instrument. But in essence the idea is the same as you've described $-$ we model classical register with values $x$ as a quantum register with orthogonal states $|x\rangle$. You can model a measurement in this way, for example. If $\sum_i B_iB_i^\dagger=I$ describes a measurement, then
+$$\Phi(\rho) = \sum_i |i\rangle\langle i| \otimes B_i \rho B_i^\dagger = \sum_i |i\rangle\langle i| \otimes \frac{B_i \rho B_i^\dagger}{ \text{Tr}(B_i \rho B_i^\dagger)} \cdot \text{Tr}(B_i \rho B_i^\dagger)$$
+is a corresponding quantum channel where the first quantum register of the output encodes the classical result $i$ and the second register contains the quantum state after the measurement.
I am starting on quantum computing and I got to entropy measurements, but that has me stuck because there seems to be a lack of resources for newcomers on those concepts and their utility. Does anyone know any good reference on them?
+",5620,,55,,10/27/2020 9:17,10/27/2020 9:17,What are good resources for newcomers on entropy measurements?,Given controlled access to the phase oracle, this is possible with surprisingly small overhead by avoiding phase estimation altogether. The technique you are after relies on applying ""quantum singular value transformations"" to objects that are known as ""block encodings"", and it was invented by Gilyén et al. in 2018. The idea was originally introduced in this paper, Appendix B, which builds on techniques from this paper. Alternatively, you can have a look at this master's thesis, Circuit 6.2.5.
+ +It appears that there is a slight error in the statement of the latter reference, as the action of $Q_f$ in the box referred to should actually be:
+ +$$Q_f : |x\rangle \otimes |0\rangle^{\otimes 3} \mapsto |x\rangle \otimes \left(\sqrt{\frac12 + \frac14f(x)}|0\rangle^{\otimes 3} + \sqrt{\frac12 - \frac14f(x)}|\psi(x)\rangle|1\rangle\right).$$
+ +Similarly, the action of $Q_2$ further down in the box should be:
+ +$$Q_2 : |0\rangle^{\otimes 3} \otimes |x\rangle \mapsto \left(\frac12\sqrt{\frac12 + \frac14f(x)}|0\rangle^{\otimes 3} + \sqrt{\frac78 - \frac{1}{16}f(x)}|1\rangle|\phi(x)\rangle\right)|x\rangle.$$
+ +All the rest should be correct as stated.
+ +Keep in mind that the operation you wish to implement, i.e., the probability oracle of $f$, makes little sense whenever $f$ takes negative values. Moreover, the square root that appears in the probability oracle behaves erratically close to $0$, so it makes sense to assume that the function values of $f$ are bounded away from $0$. Gilyén et al. overcome this by assuming that the values of $f$ are contained in $(\delta,1-\delta)$. The latter reference essentially does the same thing, but overcomes it by assuming that $|f| \leq 1/2$ and implementing the probability oracle of $\frac12 + \frac14f(x)$.
+ +As a final remark, note that the conversion you are after up to norm error $\varepsilon$ takes $O(\log(1/\varepsilon)^2)$ queries to the phase oracle, which is surprisingly little compared to the number of queries $O(1/\varepsilon)$ you would need if you used phase estimation as an intermediate step. An explanation can be given along the following lines: phase estimation gives you a binary representation of the function value $f(x)$, which you subsequently postprocess to implement the probability oracle. This is a difficult task, as it requires learning the value of $f(x)$ in the process (as you could measure after phase estimation to get a binary value of $f(x)$). The new techniques circumvent writing down such a binary representation of $f(x)$. This is why I like to call the new technique an instance of analog computation, and I refer to subroutines that give you binary representations, like phase estimation, as instances of digital computation.
+",24,,,,,3/9/2020 23:09,,,,0,,,,CC BY-SA 4.0 +10147,2,,10141,3/10/2020 8:50,,1,,"+https://medium.com/@jonathan_hui/qc-quantum-computing-series-10ddd7977abd
I have not read the full details of the paper, but have attempted to skim over the most relevant bits to the question (i.e. I could easily have missed something).
+ +As I read the paper, they are doing some calculation with a fixed size of input, and they repeat it many times (see equation 58). They ask how many times do you have to repeat it to get the same level of confidence in the output as you would with a classical Monte-Carlo. I believe that it is this ""scaling"" that the authors are referring to as giving a quadratic improvement.
+ +This bears no relation to what we usually think about scaling: how the running time scales with increasing size of input because the input is of fixed size. So, in principle, there's no problem with simulating what they want to simulate, whether it uses Clifford gates or not. So long as it fits in the memory of the computer, you can run it and repeat it many times, and you can count the number of repetitions required.
+",1837,,,,,3/10/2020 11:47,,,,2,,,,CC BY-SA 4.0 +10150,1,,,3/10/2020 13:01,,3,306,"How to construct Control-Z with square root of swap(up to some single qubit operations)? In some papers it just directly mention that it's possible but didn't tell how to do.
+",10015,,,,,11/20/2020 16:29,How to construct Control-Z with square root of swap?,Cloud IBMQ simulator ibmq_qasm_simulator can process up to 32-qubit circuits quite fast. However, I could not find any information about the simulator backend properties, e.g. how many cores, what processors, etc.
+ +Could anybody provide me with this information (or link)?
+",10336,,9006,,3/10/2020 19:24,3/10/2020 19:24,How many cores and what processors are used in the cloud ibmq_qasm_simulator?,I'm using Qiskit and I have a Quantum Circuit (say, circuit
) that gives reasonable results when using the simulator, namely
sim_backend = provider.get_backend('qasm_simulator')
+job = execute(circuit, sim_backend, shots=shots)
+
+
+However, when switching to the true machine, namely
+ +sim_backend = provider.get_backend('ibmq_16_melbourne')
+
+
+I'm experiencing very noisy, meaningless results.
+ +From my understanding, this is normal and, in these cases, error mitigation is performed by measuring the noise of the quantum circuit and then operating with this knowledge.
+ +Could someone tell me which Qiskit routine I could use to mitigate noise and how?
+ +EDIT
+ +Following the comment by Davit Khachatryan and the answer by Martin Vesely, I have prepared the code below.
+ +# --- Standard imports
+
+%matplotlib inline
+# Importing standard Qiskit libraries and configuring account
+from qiskit import QuantumCircuit, execute, Aer, IBMQ
+from qiskit.compiler import transpile, assemble
+from qiskit.tools.jupyter import *
+from qiskit.visualization import *
+# Loading your IBM Q account(s)
+provider = IBMQ.load_account()
+
+# --- Imports
+from qiskit import QuantumCircuit, execute, BasicAer
+from qiskit.tools.monitor import job_monitor
+
+import math
+from numpy import linalg as LA
+import numpy as np
+#%config jupy = 'svg' # Makes the images look nice
+
+import time
+
+import matplotlib.pyplot as plt
+
+nBits = 2
+
+shots = 8192
+
+# --- Computation of the calibration matrix
+
+from qiskit.ignis.mitigation.measurement import (complete_meas_cal,CompleteMeasFitter)
+from qiskit import *
+
+qr = QuantumRegister(2)
+meas_calibs, state_labels = complete_meas_cal(qr=qr, circlabel='mcal')
+backend = provider.get_backend('ibmq_16_melbourne')
+job = execute(meas_calibs, backend=backend, shots=1000)
+job_monitor(job, interval = 3)
+cal_results = job.result()
+
+meas_fitter = CompleteMeasFitter(cal_results, state_labels, circlabel='mcal')
+print(meas_fitter.cal_matrix)
+
+# --- Execution of the noisy quantum circuit
+
+qc = QuantumCircuit(nBits, nBits)
+qc.x(1)
+
+qc.measure(qc.qregs[0], qc.cregs[0])
+job = execute(qc, provider.get_backend('ibmq_16_melbourne'), shots = shots)
+#job = execute(qc, BasicAer.get_backend('qasm_simulator'), shots = shots)
+job_monitor(job, interval = 3)
+result = job.result()
+print(result.get_counts())
+
+# --- Error correction
+
+# Get the filter object
+meas_filter = meas_fitter.filter
+
+# Results with mitigation
+mitigated_results = meas_filter.apply(result)
+mitigated_counts = mitigated_results.get_counts(0)
+
+print(mitigated_counts)
+
+
+The noisy quantum circuit returns:
+ +{'00': 661, '11': 34, '10': 7494, '01': 3}
+
+
+The error mitigated noise circuit returns:
+ +{'00': 132.05699755089069, '11': 29.711709316932044, '01': 0.4405790117450936, '10': 8029.790714120432}
+
+
+Is that what I should expect?
+",10032,,2293,,8/17/2020 2:53,8/17/2020 2:53,Mitigating the noise in a quantum circuit,Found by just trying stuff in Quirk:
+ + +",119,,,,,3/10/2020 17:38,,,,0,,,,CC BY-SA 4.0 +10154,1,,,3/10/2020 18:47,,1,194,"I'm trying to find the steady-state of a master equation, +$$\dot{\rho}(t) = \mathcal{L}\rho(t),\tag{1}\label{1}$$ +In the form where we vectorise the density matrix and matrixify (??) the Liouvillian super operator $\rho$ is a vector representing a state, $\mathcal{L}$ is the Liouvillian, a complex matrix describing the evolution, which is not necessarily symmetric and $\dot{\rho}$ is the rate of change of $\rho$. To find the steady-state we need to set the LHS of the equation to 0 and solve for $\rho$. +This is just the eigenvector problem, $(\mathcal{L}-\lambda\pmb{I})\rho=0$ for the case where the eigenvalue, $\lambda=0$.
+ +In many systems I am studying the 0 eigenvalue of $\mathcal{L}$ is degenerate so there should be more than one solution for the original master equation. Ideally, we could find a basis for the degenerate subspace (I assume that this subspace of $\mathcal{L}$ is diagonalizable). Qutip has the function steadystate()
which, given a system Hamiltonian and some jump operators uses various numerical methods to find the steadystate. I am relatively new to using numerical methods but the systems I am dealing with are large so requires it. I have tried using the GMRES method to solve equation \eqref{1} with $\dot{\rho}=0$ but this only produces a single solution and does not help me find a basis.
An alternative approach is to use the function liouvillian()
which given the same parameters as steadystate()
returns the Liouvillian, L
, of the system in matrix form. We can then use L.eigenstate()
to find the eigenvectors associated with the zero eigenvalues. A few issues with this is that the zero eigenvalues are never quite zero but just very small, however I'm not sure this is necessarily a problem. The eigenvectors produced appear to be linearly independent, at least in the simple case I'm looking at where the system is only doubly degenerate in the zero eigenvalue, so they could form a basis for this degenerate subspace. Finally, when the Liouvillian is applied to any linear combination of these eigenvectors (as long as the cofactors are not too large) the result is zero. My only problem is that when I apply the Liouvillian to the steadystate produced by the GMRES approach the result is not zero and after some simple checks it does not appear to be in the space spanned by the eigenvectors. Is this necessarily a problem or just an issue of numerical accuracy. Is my approach of using the eigenvectors of the zero eigenvalue as a basis for the steadystate valid?
Any advice on solving this problem would be much appreciated! Thanks.
+",10338,,,,,3/10/2020 18:47,Numerical methods for finding an eigen basis of a degenerate Liouvillian,I will provide some general comments concerning noise in quantum computers.
+ +Noise in quantum systems is normal phenomena as these systems are probabilistic by nature. Under current state of development, quantum computers unfortunately does not allow to build complex deep circuits.
+ +You can of course use additional qubits to introduce error correction which can be almost perfect with sufficient number of qubits (so-called threshold theorem). But adding qubits and gates introduces another source of noise, so again depth of circuits is constrained.
+ +When quantum computers are in higher state of development, error correction will also be able to mitigate noise more effectively than nowadays.
+ +Concerning the backend you use - Melbourne. My experience is that this processor is very noisy in comparison with others provided in IBM Q. It seems that this is caused by higher number of qubits, so qubits influence each other increasing noise level.
+",9006,,,,,3/10/2020 19:20,,,,3,,,,CC BY-SA 4.0 +10156,1,10163,,3/10/2020 21:14,,2,88,"When using the BB84 algorithm for QKD, you arbitrarily choose which of two filters (bases) to use when detecting a photon: rectilinear or diagonal. If you choose rectilinear, you can detect polarization with certainty if the photon is rectilinear, i.e., either vertically- or horizontally-polarized.
+ +But how? A polarization filter that allows transmission of vertically-polarized photons will block horizontally-polarized photons and vice-versa, no? +Perhaps you use a vertically-polarized filter as the rectilinear filter and then the complete lack of a photon indicates horizontal polarization, but how would you distinguish that from, say, absorption of the photon into the fiber?
+",10340,,9006,,3/10/2020 22:33,3/12/2020 9:00,How does a rectilinear filter used for QKD-BB84 detect both horizontal and vertical polarizations?,Suppose I know a set of stabilizer generators of a qubit quantum code. Is there a systematic (and possibly efficient) way to transform this set of generators to a different set (generating the same code) with lowest possible weights? I suspect that there is no efficient way, because this problem looks very similar to the shortest basis problem of lattices which is conjectured to be very hard.
+",4312,,,,,3/11/2020 15:11,Obtaining low weight stabilizer generators,I have a unitary matrix $U$ and a quantum state $\vert \Psi \rangle$ such that +$$ U \vert \Psi \rangle = e^{i \theta} \vert \Psi \rangle.$$ +I also know that my unitary matrix and my quantum state can be written as $U = U_1\otimes U_2$ and $\vert \Psi \rangle = \vert \Psi_1\rangle\otimes\vert\Psi_2\rangle$ with matching dimensions (i.e. $U_1$ acts on the Hilbert state $\vert\Psi_1\rangle$ belongs to, same for $U_2$ and $\vert\Psi_2\rangle$).
+ +My first equation then becomes +$$U_1\vert\Psi_1\rangle \otimes U_2 \vert\Psi_2 \rangle = e^{i\theta} \vert \Psi_1 \rangle \otimes \vert \Psi_2 \rangle.$$
+ +Can I deduce the 3 following assertions from my formula above?
+ +The implication seems ""logical"" as we just separate $2$ non-related quantum states from each other, but I do not have enough confidence in my reasoning to accept this result yet. I searched for a mathematical proof, but the closer I found is the following theorem from here:
+ +++ +Theorem: Let $A$ and $B$ be two complex square matrices. If $\lambda$ is an + eigenvalue of $A$ with corresponding eigenvector $x$ and $\mu$ is an + eigenvector of $B$ with corresponding eigenvector $y$, then $\lambda\mu$ is an + eigenvalue of $A\otimes B$ with corresponding eigenvector $x\otimes y$. Moreover, every + eigenvalue of $A\otimes B$ arises as such a product.
+
that does not fit with my problem (not the good implication and more oriented toward eigenvectors).
+",1386,,5870,,3/11/2020 17:40,3/11/2020 17:40,Is kronecker product identifiable?,I have been reading papers on graph theory in quantum computing. Mostly, papers explain that they use adjacency matrix to represent the graph. But I could't find the practical simple example to understand it better. Does anybody know about such example?
+",9230,,55,,10/27/2020 9:15,10/27/2020 9:15,"Graphs are represented using oracle, where oracle is the adjacency matrix. Is there any simple example of this?",Let's say I know that +$$ +U_1|\Psi_1\rangle\otimes U_2|\Psi_2\rangle=e^{i\theta}|\Psi_1\rangle\otimes|\Psi_2\rangle. +$$ +Now, let's imagine that $U_1|\Psi_1\rangle=|\phi_1\rangle$ and $U_2|\Psi_2\rangle=|\phi_2\rangle$. So, +$$ +|\phi_1\rangle\otimes |\phi_2\rangle=e^{i\theta}|\Psi_1\rangle\otimes|\Psi_2\rangle. +$$ +Now, I would just read off your desired relations, but as a proof, it depends on how deep we need to go... Let's take the inner product of both sides with $|\phi_1\rangle\otimes |\phi_2\rangle$, and calculate the absolute value. You have +$$ +1=|\langle\phi_1|\Psi_1\rangle|\ |\langle\phi_2|\Psi_2\rangle|. +$$ +Both terms on the right-hand side satisfy $|\langle\phi_1|\Psi_1\rangle|\leq 1$, and can only achieve equality if $|\phi_i\rangle=e^{i\theta_i}|\Psi_i\rangle$ (do you need a detailed proof of that? Think of real unit vectors $\underline{v},\underline{u}$: $\underline{u}\cdot\underline{v}=\cos\gamma\leq 1$, where $\gamma$ is the angle between them.)
+ +Hence, we get overall equality if +$$ +e^{i\theta}=e^{i\theta_1}e^{i\theta_2}, +$$ +which is true provided +$$ +\theta\equiv\theta_1+\theta_2\text{ mod }2\pi. +$$
+",1837,,,,,3/11/2020 16:48,,,,0,,,,CC BY-SA 4.0 +10161,2,,10158,3/11/2020 17:28,,2,,"Let $H_1,H_2$ be two Hilbert spaces and for unit vectors $u_1,v_1 \in H_1$ and $u_2,v_2 \in H_2$ we have +$$ +u_1 \otimes u_2 = v_1 \otimes v_2 \in H_1 \otimes H_2. +$$ +Then it must be +$$ +v_1 = \lambda u_1, ~~ v_2 = \frac{1}{\lambda} u_2, +$$ +for some $\lambda \in \mathbb{C}$, $|\lambda|=1$.
+ +To see why consider a scalar product +$$ +1 = (u_1\otimes u_2, u_1\otimes u_2) = (u_1\otimes u_2, v_1\otimes v_2) = (u_1,v_1)(u_2,v_2). +$$ +Since $|(u_i,v_i)|\leq 1$ it must be $|(u_i,v_i)|=1$ for $i=1,2$. Hence $v_i = \lambda_i u_i$, where $|\lambda_i|=1$. But $u_1 \otimes u_2 = v_1 \otimes v_2 = \lambda_1 u_1 \otimes \lambda_2 u_2 = \lambda_1 \lambda_2 (u_1 \otimes u_2)$, thus $\lambda_1\lambda_2=1$.
+ +From this you can deduce your 3 assertions, though DaftWullie essentially used this argument directly in his answer.
+",5870,,5870,,3/11/2020 17:33,3/11/2020 17:33,,,,0,,,,CC BY-SA 4.0 +10163,2,,10156,3/12/2020 9:00,,0,,"I don't know the experimental details, but one option from the theory perspective is that if you know there's supposed to be a photon there, absence of a click conveys the other measurement. Of course, as you say, that's not going to hold up in situations of finite detector efficiency, photon loss during transmission, or even knowing there's been successful photon generation, etc.
+ +Perhaps a better option is to replace the filter with a polarising beamsplitter. So, one polarisation gets transmitted, and the orthogonal one gets reflected, so that you can direct both components into different detectors.
+",1837,,,,,3/12/2020 9:00,,,,2,,,,CC BY-SA 4.0 +10164,1,10165,,3/12/2020 9:43,,1,112,"I am using Qiskit - the simple circuits I am writing can either run on the hardware backend (using least_busy) or the QASM simulator backend.
+ +If I have statements like the following - (random_numbers
were generated using QRNG in the circuits - not shown here)
b = .6
+a = .3
+flt = []
+
+for rn_num in random_numbers:
+ flt.append( b*(a-rn_num) + a * rn_num)
+
+
+Where are these floating point operations performed? I am connected to IBM Quantum Experience - using Jupyter. Are these operations performed on a traditional machine or a quantum backend?
+ +My understanding is unless it is related to a Quantum circuit - everything gets executed on a traditional machine (similar to print or sockets?)
+ +Is there a document that explains this further? I read release notes - I found them a bit ambiguous. I found this comment in Aer 0.3 release note
+ +++ +Increased performance with simulations that require less floating + point numerical precision.
+
Maybe this note is referring to statevectors in floating point ...??
+",5175,,5955,,3/12/2020 11:30,3/12/2020 11:30,"In Qiskit, where is the floating point operation performed?",The Qiskit backends (quantum devices or simulators) work only when you explicitly invoke them, usually with execute
. The code in your snippet does not call qiskit
, and runs on a traditional machine.
On wikipedia, the article on quantum entanglement gives an example of the computation of a reduced density matrix. I would like to understand precisely what's going on with the computation.
+ +First the context. We consider two systems A and B respectively belonging to Hilbert spaces $\mathcal{H}_A$ and $\mathcal{H}_B$. +We consider the state of the composite system $| \Psi\rangle \in \mathcal{H}_A \otimes\mathcal{H}_B$.
+ +We are interested by the reduced density matrix on the subsystem A, given by the following formula :
+ +$$ \rho_A = \sum_j \langle j |_B ( | \Psi\rangle \langle\Psi| ) |j\rangle_B $$
+ +Then the article gives the following example . Consider the entangled state :
+ +$$ | \Psi \rangle =\frac{1}{\sqrt{2}} ( |0\rangle_A |1\rangle_B - |1\rangle_A |0\rangle_B ) $$
+ +the article says that the reduced density of A is then :
+ +$$ \rho_A = \frac{1}{2} (|0\rangle_A \langle 0|_A + |1\rangle_A \langle 1|_A)$$
+ +I wanted to compute it myself using the definition above but I'm having trouble with it.
+ +The term $| \Psi\rangle \langle\Psi|$ makes sense to me :
+ +$$ | \Psi\rangle \langle\Psi| =\frac{1}{2} ( |0\rangle_A |1\rangle_B \langle 0|_A \langle 1|_B - |0\rangle_A |1\rangle_B \langle 1|_A \langle 0|_B - |1\rangle_A |0\rangle_B \langle 0|_A \langle 1|_B + |1\rangle_A |0\rangle_B \langle 1|_A \langle 0|_B ) $$
+ +but then let's consider the first term of the sum in the definition of the reduced density matrix :
+ +$$ \langle 0|_B | \Psi\rangle \langle\Psi| |0\rangle_B $$
+ +we then have term such as
+ +$$ \langle 0|_B |0\rangle_A $$
+ +and I can't make sense of it. If $\mathcal{H}_A = \mathcal{H}_B$ it's the inner product on $\mathcal{H}_A$ but here I'm confused. Dropping the subscripts I have :
+ +$$ \langle 0| | \Psi\rangle \langle\Psi| |0\rangle + \langle 1| | \Psi\rangle \langle\Psi| |1\rangle = - \frac{1}{2} (|0\rangle \langle 0| + |1\rangle \langle 1|)$$
+ +So here there is this minus sign that is not in the given answer of Wikipedia plus I ""lost"" the information on the states. +Could you help me doing the computation correctly ?
+",10065,,9006,,3/12/2020 20:43,3/12/2020 20:43,Computation of a reduced density matrix,Like Distributed Ledger Technologies (DLT) and Blockchain, other than the few quantum algorithms available out there, are quantum computers/algorithms a solution looking for a problem?
+ +For one, I am ambivalent - with the scarcity of quantum algorithms, I am leaning towards ""a solution looking for a problem"" .
+",166,,9006,,3/12/2020 20:41,3/12/2020 22:36,"Like blockchains, other than the few quantum algorithms available out there, are quantum computers/algorithms a solution looking for a problem?",So, for example, you can compute +$$ +\langle 0|_B \big(- |0\rangle_A |1\rangle_B \langle 1|_A \langle 0|_B \big) |0\rangle_B = \big(I_A \otimes\langle 0|_B \big) \cdot \big(- |0\rangle_A \langle 1|_A \otimes |1\rangle_B \langle 0|_B \big) \cdot \big(I_A \otimes |0\rangle_B\big) = - |0\rangle_A \langle 1|_A \otimes \langle 0|_B |1\rangle_B \langle 0|_B|0\rangle_B = - |0\rangle_A \langle 1|_A \otimes 0 = 0 +$$
+",5870,,,,,3/12/2020 16:28,,,,5,,,,CC BY-SA 4.0 +10170,2,,10168,3/12/2020 22:36,,2,,"I disagree. By no means is there a scarcity of quantum algorithms. Consider for example this review on Quantum Machine Learning. Therein the term qBLAS is contained for Quantum Linear Algebra Subroutines. This term describes all the quantum algorithms that exist for basic linear algebra tasks. Together with the (in)famous Grover Algorithm that gives a quadratic speedup for unstructured search problems and other quantum algorithms one has a large toolbox of generic quantum speedups at one's disposal.
+ +As linear algebra tasks and search are basically used everywhere, quantum algorithms can yield generic speedups in nearly any field and will therefore be extremely important in the future.
+ +But in the present NISQ era, we are indeed in a place where one can say that quantum computers are a ""solution looking for a problem"". Why is this the case? State-of-the-art quantum computers have few and noisy qubits, which means that none of the algorithms outlined above can be faithfully implemented.
+ +Today's quantum computers can already outperform classical computers in very artifical and useless tasks. But people still hope that we can use those devices to do useful stuff. One major candidate are hybrid approaches like the Variational Quantum Eigensolver that can possibly aid quantum chemistry -- but while many such methods are proposed, no evidence exists that they are actually better than classical methods yet.
+ +So while quantum computers in general are not a solution looking for a problem, today's NISQ devices, in a way, are.
+",10250,,,,,3/12/2020 22:36,,,,0,,,,CC BY-SA 4.0 +10171,2,,6399,3/13/2020 0:05,,2,,"If you are using the QFT inside a bigger circuit you really can't avoid the swaps in the QFT and/or the invQFT the reason being that the value of qubit x1 dictates the symmetry of the phases in your entire superposition. Pay attention to how the phases look like in the following images:
+ + +I think your intuition in question 1 is correct but it will only work in isolation because you are then literally swapping the wires. If you need the outcome of the QFT to be used as input for something else in the circuit you'll have to use swaps at some point.
+There is a way you can work around this if you separate your input and output registers but this means you need twice as many qubits :) Then you can do something like:
+ +Quirk link so you can play with it yourself.
+Note: some people mix up the invQFT with the QFT and so I myself I'm a bit lost but it should be fairly straightforward to adapt this technique to Nielsen's circuit I think.
+Here is a video where you can see my mental process and how I got to this idea while exploring the QFT myself: https://youtu.be/HlMuFqZ9cSE?t=1158 (minute 19:18)
+I hope this was helpful! :)
+",7322,,13968,,12/19/2021 3:05,12/19/2021 3:05,,,,0,,,,CC BY-SA 4.0 +10172,1,,,3/13/2020 2:31,,2,517,"Is my understanding correct that in this example the Hamiltonian measurement is not performed through measuring individual Pauli operators because all its terms are mutually commuting? So, for each run, we just measure all the qubits in the $Z$ basis, and substitute the values into the classical expression?
+ +But if we added a term like $X_1 Y_2$, we would have to double the number of runs, right?
+",6313,,491,,8/29/2020 19:00,10/21/2022 7:04,VQE Cirq example,If we have prepared an arbitrary anzats/trial two-qubit state:
+ +$$\psi = a |00\rangle + b |01\rangle+ c |10\rangle+ d |11\rangle$$
+ +And we want to calculate the expectation value of individual Pauli terms of this Hamiltonian that is the two qubit case of the used one in the VQE Cirq example:
+ +$$ \langle H \rangle = \alpha_1 \langle Z_1 Z_2 \rangle + \alpha_2 \langle Z_1 \rangle + \alpha_3 \langle Z_2 \rangle $$
+ +Note that:
+ +\begin{align*} +\langle Z_1 Z_2 \rangle = |a|^2 - |b|^2 - |c|^2 + |d|^2 \\ +\langle Z_2 \rangle = |a|^2 - |b|^2 + |c|^2 - |d|^2 \\ +\langle Z_1 \rangle = |a|^2 + |b|^2 - |c|^2 - |d|^2 +\end{align*}
+ +So, just by performing measurements in the $Z$ basis will give you all the expectation values for the given $H$, because by these measurements we will obtain all the probabilities ($|a|^2$, $|b|^2$, $|c|^2$ and $|d|^2$). More about these calculations can be found in this answer. If there are other terms like $X_1 Y_2$ one should measure also in different basis (for more info here is my Qiskit tutorial on VQE, where at the end a procedure for finding the expectation value of $X_1 Y_2$ Pauli term is described).
+ +What I used above is that all three terms have a common orthonormal basis. Maybe this is the crucial criterion, which implies the commutativeness. Here is a theorem from the M. Nielsen and I. Chuang textbook (page 77) about the common orthonormal basis of two commuting Hermitian matrices.
+ +Theorem 2.2: (Simultaneous diagonalization theorem) Suppose $A$ and $B$ are Hermitian operators. Then $[A, B] = 0$ if and only if there exists an orthonormal basis such that both $A$ and $B$ are diagonal with respect to that basis. We say that A and B are simultaneously diagonalizable in this case.
+ +P.S. I haven't read the Cirq's implementation, so maybe there will be a better answer.
+",9459,,9459,,4/1/2020 13:00,4/1/2020 13:00,,,,0,,,,CC BY-SA 4.0 +10174,1,,,3/13/2020 14:30,,2,233,"I have a state psi
as an ndarray of shape (2 ** 3
,) s.t.
psi[0]= amplitude of 000
psi[1] = amplitude of 001.
So my qubit ordering is reversed w.r.t. qiskit's. To initialize the circuit correctly and apply the IQFT on the first 2 qubits from the left I tried the following code:
+ +import qiskit as qt
+from qiskit.aqua.circuits import FourierTransformCircuits as QFT
+
+ circuit = qt.QuantumCircuit(3)
+ circuit.initialize( psi, [i for i in reversed(circuit.qubits)])
+
+ QFT.construct_circuit(circuit=circuit, qubits=circuit.qubits[:2], inverse=True)
+
+ backend = qt.Aer.get_backend('statevector_simulator')
+ final_state = qt.execute(circuit, backend, shots=1).result().get_statevector()
+
+
+From the tests I've run, final_state
is not what I expected: defining
exact = np.kron(IQFT_matrix(2),np.eye(2)).dot(state)
with IQFT_matrix(2)= IQFT_matrix for 2 qubits.
np.testing.assert_array_almost_equal(final_state, exact)
+
+
+fails. Can you please help me find the problem?
+",10356,,55,,8/12/2020 8:33,12/30/2022 14:05,qiskit: IQFT acting on subsystem of reversed-ordered qubits state,I have two question concerning information content of qubit.
+ +Question 1: How many classical bits are needed to represent a qubit:
+ +A qubit can be represented by a vector $q = \begin{pmatrix}\alpha \\\beta \end{pmatrix}, ~~ \alpha, \beta \in \mathbb{C}$. So, we need four real numbers to represent it. But when facts that (i) $|\alpha|^2+|\beta|^2 = 1$ and (ii) two qubits which differ in global phase only are indistinguishable, are taken into account, only two real numbers are necessary (angles on Bloch sphere). Moreover, we can choose a precission of the qubit representation (i.e. number of decimal places in $\alpha$ and $\beta$ or Bloch sphere angles) which influence number of classical bits needed to described the qubit.
+ +So, it seems to me that the qubit representation cannot be used for measuring qubit information content but only memory consumption in simulation. Am I right?
+ +Question 2: What is an (effective) information content of qubit:
+ +A superdense coding enable us to send two classical bits via one qubit. But on the other hand you need two entangled qubits prepared in advance.
+ +Given these facts, what is an information content of qubit? One or two classical bits? Or do I need to use another angle of view given the fact that qubits are ""continuous"" (i.e. described by complex numbers $\alpha$ and $\beta$)?
+",9006,,55,,10/27/2020 9:14,10/27/2020 9:14,How many classical bits are needed to represent a qubit?,There is the parameter do_swaps
when you construct the fourier transform circuit.
do_swaps (bool): Boolean flag to specify if swaps should be included to align
+ the qubit order of input and output. The output qubits would
+ be in reversed order without the swaps.
+
+",9831,,,,,3/13/2020 15:16,,,,1,,,,CC BY-SA 4.0
+10177,1,,,3/13/2020 15:55,,2,28,"The paper, Quantum deletion is possible via a partial randomization procedure claims that it is possible to bypass the no-deleting theorem by a procedure called R-deletion. But this seems to go against the original no-deleting theorem. If not, why so?
+ +And doesn't the following line from the first paper actually convey a swapping operation which has been categorically excluded by Pati and Braunstein?
+ +++",4235,,55,,10/28/2020 9:22,10/28/2020 9:22,Is quantum deletion via a partial randomization procedure possible?,But, whatever this state be in our actual realization of R-deletion, we do not recover now, from the linearity of Quantum Mechanics, the result in {1} that $|A_\psi\rangle= \alpha|A_H\rangle +\beta|A_V\rangle$.
+
As Martin Vesley has mentioned in his answer, there are some error correction techniques that require additional qubits and gates resources, and how we know the resources of nowadays QCs are limited, and that's why those techniques are not so useful today. But in 2017 new error correction techniques were proposed that don't require additional gates/qubits. As stated in the abstract of S. Endo et al [1] paper: two quantum error mitigation (QEM) techniques have been introduced recently, +namely, error extrapolation (proposed by Y. Li and S. C. Benjamin [2] and K. Temme et al [3]) and quasiprobability decomposition (proposed by K. Temme et al [3]). How I understand, this Qiskit tutorial is an implementation of the second technique. The tutorial is written very nicely and intuitively, so I highly recommend it.
+ +Here I will try to explain the first technique: error extrapolation. We want to estimate something from our circuit, let's call it $E^*$ (can be the expectation value of Hamiltonian or something else). Because of noise we always obtain a different value than $E^*$. Suppose we have a $\lambda$ parameter (in this experimental paper [4] they used pulse duration as a parameter: the gates are implemented via microwave pulses) that we can change and run different experiments with given values of $\lambda$. This give us different values for $E(\lambda)$ from which we will be able to construct the following system of equations:
+ +\begin{cases} +E(\lambda_1) = E^* + Noise(\lambda_1) +\\ +E(\lambda_2) = E^* + Noise(\lambda_2) +\\ +E(\lambda_3) = E^* + Noise(\lambda_3) +\\ +... +\end{cases}
+ +By expressing the $Noise(\lambda)$ with some suitable function (e.g. a polynomial function) one can solve the system of equation and find the desired $E^*$ value ""without"" noise. In some cases, it works XD. I mean there should be the satisfaction of some conditions (e.g good fitting of chosen function to the actual noise).
+ +These techniques are increasing the circuit depth that can be used, but that increment, of course, is not limitless (more insights can be gained from the Fig.2 from the [4] paper).
+",9459,,9459,,3/13/2020 18:46,3/13/2020 18:46,,,,3,,,,CC BY-SA 4.0 +10179,1,10180,,3/13/2020 18:44,,5,1085,"I'm trying to replicate with qiskit the results of this paper in which basically they implement a quantum version of the Principal Component Analysis applying Quantum Phase Estimation algorithm in order to find eigenvalues and eigenvectors from a covariance matrix.
+ +Everything works fine for the 2x2 covariance matrix case but when they extend the circuit to the 4x4 case it's not very clear how they modify the phase kickback part of the quantum circuit. +In the picture that shows the general circuit for QPE, some multi-target controlled-U gates are shown:
+ +
+In the 2x2 case this can be made using simple cU3 gates repeated several times as shown in this answer, where the parameters $\theta, \phi, \lambda$ that are needed for the cU3 gate are calculated using the qiskit function euler_angles_1q directly from the $e^{2\pi i\rho}$ 2x2 matrix where $\rho$ is the normalized covariance matrix:
$\rho=\frac{\sigma}{tr(\sigma)}$
+ +($\sigma$ is the 2x2 covariance matrix for which we want to find the eigenvalues and the eigenvectors)
+ +But for the 4x4 case they provide a circuit that does the phase kickback with several U3 gates
+
An example of constructing (with help of Qiskit) a controlled version of some simple 4x4 unitary matrix:
+ +$$ +U = \begin{pmatrix} +\mathrm{e}^{i g_1} & 0 & 0 & 0 \\ +0 & \mathrm{e}^{i g_2} & 0 & 0 \\ +0 & 0 & \mathrm{e}^{i g_3} & 0 \\ +0 & 0 & 0 & \mathrm{e}^{i g_4} \\ +\end{pmatrix} +$$
+ +where $g_s$ are some given constants. It can be shown that this corresponds to the following circuit:
+ +from qiskit import *
+
+g_1 = 1.2
+g_2 = 1.5
+g_3 = 0.7
+g_4 = -0.9
+
+q = QuantumRegister(2, ""q"")
+circuit = QuantumCircuit(q)
+
+circuit.cu1(g_4, q[0], q[1])
+circuit.x(q[1])
+circuit.cu1(g_3, q[0], q[1])
+circuit.x(q[0])
+circuit.cu1(g_1, q[0], q[1])
+circuit.x(q[1])
+circuit.cu1(g_2, q[0], q[1])
+circuit.x(q[0])
+
+
+to obtain the controlled version of the circuit we will use Qiskit's get_controlled_circuit()
method:
from qiskit.aqua.utils.controlled_circuit import get_controlled_circuit
+
+control_qubit = QuantumRegister(1, ""a"")
+controlled_circuit = QuantumCircuit(q, control_qubit)
+
+controlled_circuit = get_controlled_circuit(circuit, control_qubit[0])
+print(controlled_circuit.qasm())
+
+
+How I understand the steps of the get_controlled_circuit()
method:
+1) it takes your given circuit
+2) changes your gates to Qiskit's basis gates (u1, u2, u3, cx).
+3) for each given basis gate it modifies and replaces it with the controlled version of it (it has a ""dictionary of methods"" that implements the controlled circuits for all basis gates).
So, to sum up. Firstly one needs to decompose the given $U$ operator into gates, then for each gate construct the controlled version of it. In other words, if one has a circuit gate_1 gate_2 gate_3
, the controlled version of it will look like this controlled_gate_1 controlled_gate_2 controlled_gate_3
. If the control qubit is in the $| 1 \rangle$ state all gates will be executed, and if it is in the $| 0 \rangle$ state nothing will happen (as is expected by definition of the control operations). And if you want to implement a controlled version of $U^n$ operator, you can just apply $n$ controlled $U$ circuits.
Final Notes: To obtain a circuit from a given unitary matrix is not a trivial problem and I don't know a general solution for that. Usually, in QPE algorithm implementations, one is given a Hamiltonian $H$ operator expressed by a sum of Pauli product terms and the problem is to simulate $e^{iHt}$ unitary operator to estimate the phase $\varphi$, from $e^{iHt} | \psi \rangle = e^{iEt} | \psi \rangle = e^{i 2 \pi \varphi} | \psi \rangle$, where $| \psi \rangle$ is some eigenstate of $H$. The $H$ is given in this form:
+ +$$H = P_1 + P_2 + P_3 + P_3$$
+ +where $P_s$ are the Pauli terms (like $X \otimes Y \otimes Y$ or $Z \otimes Y$). Simulation of the $e^{i P t}$ for a given $P$ Pauli term can be done as described in J.D. Whitfield et al [1] paper. If we have all circuits for Pauli terms we will be able to simulate the whole Hamiltonian with the use of Trotterization techniques (more info can be found in [1] paper).
+",9459,,9459,,3/14/2020 11:59,3/14/2020 11:59,,,,3,,,,CC BY-SA 4.0 +10181,1,,,3/13/2020 21:29,,2,187,"I'm performing QFT using the following code:
+ +# Importing standard Qiskit libraries and configuring account
+from qiskit import *
+from qiskit.tools.monitor import job_monitor
+provider = IBMQ.load_account()
+
+# --- Imports
+from numpy import linalg as LA
+import numpy as np
+
+
+def qftA(circ, n):
+ """"""n-qubit QFT on the qubits in circ.""""""
+ for k in range(n):
+ j = n - k
+ circ.h(j - 1)
+ for i in reversed(range(j - 1)):
+ circ.cu1(2 * pi / 2**(j - i), i, j - 1)
+ for i in range(n//2):
+ circuit.swap(i, n - i - 1)
+
+# --- Parameters
+nBits = 2
+shots = 8192
+pi = np.pi
+
+# --- Input data
+
+# --- Defining the array coefficients
+coefficients = [0., 1., 3., 1.]
+coefficients = coefficients / LA.norm(coefficients)
+
+# --- Defining the quantum circuit
+circuit = QuantumCircuit(nBits, nBits, name = ""Quantum circuit"")
+
+# --- Quantum circuit initialization
+circuit.initialize(coefficients, range(nBits))
+
+# next, do a qft
+qftA(circuit, nBits)
+circuit.measure(range(nBits), range(nBits))
+
+#sim_backend = provider.get_backend('ibmq_16_melbourne')
+#sim_backend = provider.get_backend('ibmq_vigo')
+#sim_backend = provider.get_backend('ibmq_essex')
+sim_backend = BasicAer.get_backend('qasm_simulator')
+
+job = execute(circuit, sim_backend, shots=shots)
+job_monitor(job, interval = 3)
+result = job.result().get_counts()
+
+print(result)
+
+
+I have performed a comparison between the simulator and machine results:
+ +QASM SIMULATOR
+{'00': 4648, '01': 1680, '10': 169, '11': 1695}
+
+MELBOURNE
+{'00': 3850, '01': 2180, '10': 508, '11': 1654}
+
+VIGO
+{'00': 4757, '01': 1937, '10': 308, '11': 1190}
+
+ESSEX
+{'00': 4251, '01': 1495, '10': 883, 11': 1563}
+
+LONDON
+{'00': 4280, '01': 1332, '10': 608, '11': 1972}
+
+BURLINGTON
+{'00': 2880, '01': 1638, '10': 1745, '11': 1929}
+
+IBMQX2
+{'00': 4425, '01': 1381, '10': 763, '11': 1623}
+
+OURENSE
+{'00': 4922, '01': 1766, '10': 353, '11': 1151}
+
+
+ARMONK
+single qubit
+
+
+So, depending on what I use I obtain different results. Could someone tell me why and suggest remedies?
+ +EDIT +I have removed the swap at the end of the circuit, as suggested by Davit Khachatrya, and these are the results I achieve
+ +qasm_simulator
+{'00': 4639, '10': 1651, '01': 201, '11': 1701}
+
+ibmq_16_melbourne
+{'00': 4210, '10': 1828, '01': 531, '11': 1623}
+
+ibmq_vigo
+{'00': 4676, '10': 1697, '01': 406, '11': 1413}
+
+ibmq_essex
+{'00': 4013, '10': 1462, '01': 1010, '11': 1707}
+
+ibmq_london
+{'00': 4341, '10': 1565, '01': 678, '11': 1608}
+
+ibmq_burlington
+{'00': 3798, '10': 1376, '01': 1770, '11': 1248}
+
+ibmqx2
+{'00': 4281, '10': 1481, '01': 621, '11': 1809}
+
+ibmq_ourense
+{'00': 4533, '10': 2037, '01': 293, '11': 1329}
+
+
+My feeling is that I have now less noisy results.
+",10032,,10032,,3/19/2020 8:44,3/19/2020 8:44,Different QFT results when using Simulator or Quantum Machine,It takes an infinite amount of information to specify the state of a qubit. That's for the reason you said: those two angles to specify the point on the Bloch sphere are continuous, and that means you need an infinite amount of precision.
+ +That being said, only one bit of accessible information is gained by measuring a qubit. If you had enough time and money, and many copies of the same state, you could keep doing measurements on the qubit. With each measurement you would narrow down uncertainty on what the exact state of the qubit is.
+ +As for superdense coding, it does turn out that transferring one qubit from a system of two can transfer both classical bits, but it's important to remember qubits act a bit nonintuitively in larger systems. It's incorrect to say that one qubit is here and the other is there. They together constitute a two-qubit state, which in general is not divisible into two one-qubit states.
+",1867,,,,,3/14/2020 5:15,,,,0,,,,CC BY-SA 4.0 +10183,2,,10175,3/14/2020 6:14,,7,,"There are two types of information in physics:
+ +Physics doesn't answer the question ""What is (classical or quantum) information?"". This is philosophic question, and physics never answers questions of this kind. Instead, physics answers another question ""How (classical or quantum) information is measured?"". The answer is trivial:
+ +Then people hear this first time, they think this is just a tautology, but this is not; this is mathematically correct way of thinking about information. We don't use vague terms like ""effective information"" and don't ask vague questions like ""What is an (effective) information content of qubit"".
+ +Now we come to the question: How these two types of information are related?
+ +First, how many bits are needed to represent a qubit? We need infinite number of bits to represent a qubit with infinite accuracy; but infinite accuracy is never needed; any practical computational problem requires finite accuracy. You can run quantum algorithms on a classical computer, given the classical computer has enough memory (memory requirements grow exponentially with the number of qubits).
+ +Another question: how many bits can be transmitted by transmitting one qubit?. Here we have 2 fundamental results: Holevo theorem and Superdense coding.
+",2105,,2105,,3/14/2020 6:48,3/14/2020 6:48,,,,0,,,,CC BY-SA 4.0 +10185,1,10201,,3/14/2020 12:05,,2,141,"The stabilizers of a given graph all commute, thus it must be possible to diagonalize them simultaneously. If I start with one graph state and write down all its stabilizers is there an easy way to derive a complete eigenbasis of the stabilizers in terms of graph states?
+",5705,,5955,,3/14/2020 12:32,3/16/2020 10:19,Constructing an eigenbasis of graph states for a set of stabilizers,I have a little difficulty with understanding. How do I properly visualize the change of qubit's basis as a rotation?
+ +Let's say that we have classical basis vectors, $|0\rangle$ and $|1\rangle$. Now, we can change this basis into the $\{|+\rangle, |-\rangle\}$ one by applying a Hadamard gate:
+ +$$ H|0\rangle = \frac{1}{\sqrt{2}}\begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix} \begin{bmatrix} 1 \\ 0 \end{bmatrix} = \frac{1}{\sqrt{2}} \begin{bmatrix} 1 \\ 1 \end{bmatrix} = \frac{|0\rangle + |1\rangle}{\sqrt{2}} = |+\rangle, $$
+ +$$ H|1\rangle = \frac{1}{\sqrt{2}}\begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix} \begin{bmatrix} 0 \\ 1 \end{bmatrix} = \frac{1}{\sqrt{2}} \begin{bmatrix} 1 \\ -1 \end{bmatrix} = \frac{|0\rangle - |1\rangle}{\sqrt{2}} = |-\rangle. $$
+ +Is there some analogy between the Hadamard gate and classical rotation matrix, which can be defined as
+ +$$ R(\theta) = \begin{bmatrix} \cos \theta & -sin \theta \\ \sin \theta & \cos \theta \end{bmatrix},$$
+ +for a rotation in the counterclockwise direction by the angle of $\theta$?
+ +I think that my problem lies in viewing the vectors $|0\rangle$ and $|1\rangle$ as two perpendicular vectors on a plane of real numbers. But, we are dealing with two vectors of complex numbers, so I guess we shouldn't think of them in this way, but rather than that, use the Bloch sphere?
+",2098,,2105,,3/15/2020 20:06,3/15/2020 20:06,How should I understand the change of qubit's basis as a rotation?,The first postulate of quantum mechanics that can be found in the M. Nielsen and I. Chuang textbook:
+ +Postulate 1: Associated to any isolated physical system is a complex vector space with the inner product (that is, a Hilbert space) known as the state space of the system. The system is completely described by its state vector, which is a unit vector in the system’s state space.
+ +So, If one has some state $|\psi\rangle = \alpha |0\rangle + \alpha |1\rangle = \begin{pmatrix} \alpha \\ \beta \end{pmatrix}$, it can be described as a vector in the Hilbert space with $\alpha$ and $\beta$ complex coordinates. Because of normalization $|\alpha|^2 + |\beta|^2 = 1$, the length of that vector is $1$. When we apply a unitary operator the length doesn't change (still $|\alpha'|^2 + |\beta'|^2 = 1$). So unitary operations are just rotations of that vector in the Hilbert space (they don't change the length of it). If we change the basis with a unitary operator then it can be described as a rotation of basis vectors in the Hilbert space (the basis vectors will not change their lengths, they will just point to the other directions).
+ +As mentioned in the comments, not only this. Like for rotations in the 3D Euclidean space, the inner product of two vectors in the Hilbert space is also preserving under the unitary transformation (Definition 2. or 3. from wiki). For 3D Euclidean space rotations, this also implies that the angles between the vectors are not changing. For basis vectors in the Hilbert space, this means that if they were orthogonal they will stay orthogonal after the unitary transformation.
+",9459,,9459,,3/14/2020 18:34,3/14/2020 18:34,,,,4,,,,CC BY-SA 4.0 +10188,2,,10186,3/14/2020 13:32,,5,,"Hadamard gate can be interpreted as a rotation in 3D Euclidean space (on Bloch sphere) by angle $\pi$ around X+Z axis.
+ +The qubit rotation by angle $\theta$ around axis pointed by unit vector $\textbf{n}=\{n_x,n_y,n_z\}$ is described by rotation operator ($X$, $Y$ and $Z$ are Pauli matrices) +\begin{align} +R_{\textbf{n}}(\theta)=&n_xe^{-i\frac{\theta}{2}X}+n_ye^{-i\frac{\theta}{2}Y}+n_ze^{-i\frac{\theta}{2}Z}=\\ +=&\begin{pmatrix} +\cos\frac{\theta}{2}-in_z\sin\frac{\theta}{2}&(-in_x-n_y)\sin\frac{\theta}{2}\\ +(-in_x+n_y)\sin\frac{\theta}{2}&\cos\frac{\theta}{2}+in_z\sin\frac{\theta}{2} +\end{pmatrix} +\end{align} +If we choose $\theta = \pi$ and $\textbf{n}=\{\frac{1}{\sqrt{2}},0,\frac{1}{\sqrt{2}}\}$, then +\begin{align} +R_{\textbf{n}}(\pi)=&\begin{pmatrix} +-\frac{i}{\sqrt{2}}&-\frac{i}{\sqrt{2}}\\ +-\frac{i}{\sqrt{2}}&\frac{i}{\sqrt{2}} +\end{pmatrix}=-\frac{i}{\sqrt{2}}\begin{pmatrix} +1&1\\ +1&-1 +\end{pmatrix} +\end{align}
+ +which coincides with Hadamard gate up to the global phase $-i$
+",2105,,2105,,3/15/2020 20:03,3/15/2020 20:03,,,,0,,,,CC BY-SA 4.0 +10189,1,,,3/14/2020 14:10,,2,357,"Seeing a state of qubit is too complicated in Cirq +I don't want to simulate, I would be happy for debugging, to see the probability/ amplitude of the state of a qubit, without measure and simulate
+ +Something like:
+ +circuit = cirq.Circuit()
+msg, R, S = cirq.LineQubit.range(3)
+
+circuit.append([cirq.H(R),cirq.CNOT(R, S)])
+
+print(R.state)
+""R = 0.12|0>+0.58|1>""
+or
+""(0.12,0.58)
+
+
+Is there anyway to do this?
+",10364,,5955,,3/14/2020 14:20,3/14/2020 18:20,Cirq - Print state of qubit,Can someone help me in understanding the program on the link given below? +I would really appreciate if someone could give a detailed explanation ...
+ +https://github.com/quantumlib/Cirq/blob/master/examples/hhl.py
+",10365,,5955,,3/14/2020 17:07,3/14/2020 17:07,Explanation of HHL Cirq implementation,Your mental model of how cirq works is slightly off. You don't invoke operations on a qubit in one line and then check how that qubit changed in another line. You create a circuit in one line and then ask about its properties, such as its effect on a qubit, in another line.
+ +In this case, you want to ask what the final_wavefunction
of your circuit is and then trace out the other qubits. The output of final_wavefunction
is just a normal numpy array, which you can then analyze. To avoid a gotcha where qubits not operated on by the circuit are not included in the wavefunction, it's important to specify a qubit_order
for final_wavefunction
. Cirq also includes methods like wavefuntion_partial_trace_as_mixture
which can tell you about specific qubits or subsets of qubits from a wavefunction. The main annoyance there is that because all you have is a numpy array you need to talk in indices instead of in qubits.
Basically, do this:
+ +import cirq
+
+msg, R, S = cirq.LineQubit.range(3)
+circuit = cirq.Circuit(cirq.H(R), cirq.CNOT(R, S))
+
+full_wavefunction = cirq.final_wavefunction(
+ circuit,
+ qubit_order=[msg, R, S])
+qubit_mixture = cirq.wavefunction_partial_trace_as_mixture(
+ full_wavefunction,
+ keep_indices=[1]) # offset 1 in qubit order [msg, R, S] is R
+
+for probability, case in qubit_mixture:
+ print(f'{probability:%} {cirq.dirac_notation(case)}')
+
+# prints:
+# 49.999997% |0⟩
+# 49.999997% |1⟩
+
+",119,,,,,3/14/2020 18:20,,,,0,,,,CC BY-SA 4.0
+10192,1,10193,,3/14/2020 18:28,,2,96,"Considering a 3 qubit system, what does the matrix operation will look like if I apply CNOT on qubit 1 and qubit 2 and then apply CNOT on qubit 1 and qubit 3?
+",10366,,,,,3/17/2020 10:05,2 qubit gate operation on multi qubit systems,By taking into account this representation of the CNOT gate:
+ +$$CNOT = | 0 \rangle \langle 0 | \otimes I + | 1 \rangle \langle 1 | \otimes X$$
+ +We can write:
+ +$$CNOT(1, 3) = | 0 \rangle \langle 0 | \otimes I \otimes I + | 1 \rangle \langle 1 | \otimes I \otimes X$$
+ +$$CNOT(1, 2) = | 0 \rangle \langle 0 | \otimes I \otimes I + | 1 \rangle \langle 1 | \otimes X \otimes I$$
+ +That's why:
+ +\begin{align*} +&CNOT(1, 3) CNOT(1, 2) = | 0 \rangle \langle 0 | \otimes I \otimes I + | 1 \rangle \langle 1 | \otimes X \otimes X = \\ +&= +\begin{pmatrix} +1 & 0 \\ +0 & 0 +\end{pmatrix} +\otimes +\begin{pmatrix} +1 & 0 \\ +0 & 1 +\end{pmatrix} +\otimes +\begin{pmatrix} +1 & 0 \\ +0 & 1 +\end{pmatrix} ++ +\begin{pmatrix} +0 & 0 \\ +0 & 1 +\end{pmatrix} +\otimes +\begin{pmatrix} +0 & 1 \\ +1 & 0 +\end{pmatrix} +\otimes +\begin{pmatrix} +0 & 1 \\ +1 & 0 +\end{pmatrix} = +\end{align*}
+ +$$= +\begin{pmatrix} +1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ +0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ +0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ +0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ +0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ +0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\ +0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ +0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ +\end{pmatrix}$$
+ +Answers to the related questions: [1] and [2].
+",9459,,9459,,3/17/2020 10:05,3/17/2020 10:05,,,,2,,,,CC BY-SA 4.0 +10194,1,10196,,3/14/2020 22:56,,2,186,"I am implementing the teleportation algorithm on IBM Q Experience (GUI interface). Certain operations on the third qubit are only performed if the classical measurement result is 1, for example
+ +if (c==1) x q[2];
+
+
+However, it removes all the if statements after it is transpiled (lines 19 and 21). Do you know what I did wrong?
+ + +",9676,,9006,,3/14/2020 23:11,3/16/2020 14:13,How to implement controlled gate based on measurement (quantum teleportation)?,What is the cost (number of gates) of $\sum_{i=0}^{N-1}| i \rangle \langle i|\otimes U_i$ in terms of $N$ and the costs of the unitaries $U_i$? Say the gate set consists of arbitrary one-qubit gates and the CNOT. The unitaries $U_i$ act on an arbitrary number of qubits.
+ +I know, for example, that the Toffoli gate, which is of the above form with $N=4$ and $U_3=X$, can be constructed with $6$ CNOTs.
+",8881,,8881,,3/15/2020 19:35,3/15/2020 19:35,Cost of controlled-$U_i$,Currently IBM Q does not support IF statement on real quantum processor. The IF can be used on simulator only. However, there is a theorem stating that quantum gates controlled by classical register can be replaced by those controlled by qubits before measurement.
+ +So, you can simply replace the statement
+ +measure q[1] -> c[1];
+if (c == 1) x q[2];
+
+
+by
+ +cx q[1], q[2];
+
+
+i.e. qubit $q_1$ controls CNOT acting on $q_2$.
+ +Similarly, you can do that for controlled $Z$ gate. In the end, you will get same results as with IF statement.
+",9006,,,,,3/14/2020 23:08,,,,4,,,,CC BY-SA 4.0 +10197,2,,10185,3/15/2020 0:47,,2,,"I'm not sure I understand the question, since this seems quite straightforward.
+ +Graph states are Clifford states, so for a state on $n$ qubits, the set of stabilizers has $n$ generators looking like
+ +$$i^k P_1\otimes\ldots\otimes P_n$$
+ +where $k\in\{0,1,2,3\}$ and the $P$'s are Pauli $X,Y,$ or $Z$ operators. (For graph states, these stabilizers look like $\{X_v Z_{\text{Nbhd}(v)} : v \in V\}$ )
+ +Each Pauli has two eigenvectors. If we choose one of them and call it $|\psi_i\rangle$, and call its corresponding eigenvalue $\lambda_i$, for each $P_i$, then $|\psi_1\rangle\otimes\ldots\otimes|\psi_n\rangle$ will be an eigenvector of the stabilizer with eigenvalue $i^k\prod_i \lambda_i$.
+",6118,,,,,3/15/2020 0:47,,,,0,,,,CC BY-SA 4.0 +10198,1,,,3/15/2020 9:58,,0,82,"Is Quantum Entanglement the one-dimensional spatial relationship between two particles as described by mathematics?
+ +By one dimensional I mean, when they travel at opposite directions their spin is also opposite (without any spooky communication between the two, just the plain fact of their direction as described by our observations).
+",10370,,55,,3/15/2020 17:31,3/15/2020 17:31,Is Quantum Entanglement the one-dimensional spatial relationship between two particles as described by mathematics?,The following diagram is from Experimental Realization of a Quantum Autoencoder: The Compression of Qutrits via Machine Learning
+
How this setup works:
+ +What will be obtained from this set up is the state vector of the input light (I don't use the term 'photon' because it might not be necessary) just before entering stage (c) and its state vector when exiting stage (c). Due to the |H> |V> two different polarization states and two different optical paths (upper one and lower one), there are three bases states (notice that this beam displacer only deflects |v> polarized light so not four bases), so its state vector is 3-dimensional at the input of (c) and is expected to be 2-dimensional at the output of (c) because the autoencoder part is supposed to compress the state vector such that the upper path basis is always 0 valued.
+ +My question is, why is it necessary to use single photon for this experiment?
+ +In order to distinguish the statistics of different state vectors, I can just use something to measure the intensity of the output light at the two optical path; specifically for the lower path at output, I use another beam displacer to separate V and H light and measure their intensities separately. With knowing those intensities, I can get the coefficients of each basis and hence known exactly the state vector, or can I?
+",7739,,7739,,3/18/2020 4:43,3/18/2020 4:43,Are single photons necessary for this quantum autoencoder implementation?,A qubit is a two-level quantum system and these two-levels in some hardware can be implemented by spins of the electron, but it's not the only option (can be just two ""stabile"" quantum states not essentially associated with spins). In this sense it is not only about the spin (directional) correlation between qubits, it's about state correlation between them. But suppose that we have spin qubits: two quantum levels are two spin directions (up or down) in some chosen direction. An example of an entangled state for two qubits:
+ +$$| \psi \rangle = \frac{1}{\sqrt{2}}\left( | \downarrow_z \rangle| \downarrow_z \rangle + | \uparrow_z \rangle| \uparrow_z \rangle \right)$$
+ +This means that if we will do a measurement of spin in the z-direction we will always measure both qubits down or up (nice explanation of the entanglement 2:50 - 4:15 of Anton Zeilinger's presentation). But not only this. A valid question is what is our $|\psi\rangle$ state expressed by spin up and down states in x-direction. In other words what will be the measurement results, if we measure the spin in the x-direction. Note that (video lecture by Allan Adams about spin: especially from 47:45-52:45):
+ +\begin{align*} +| \uparrow_z \rangle = \frac{1}{\sqrt{2}}\left( | \uparrow_x \rangle + | \downarrow_x \rangle \right) +\qquad +| \downarrow_z \rangle = \frac{1}{\sqrt{2}}\left( | \uparrow_x \rangle - | \downarrow_x \rangle \right) +\end{align*}
+ +That's why:
+ +$$| \psi \rangle = \frac{1}{\sqrt{2}}\left( | \downarrow_x \rangle| \downarrow_x \rangle + | \uparrow_x \rangle| \uparrow_x \rangle \right)$$
+ +So, if we will measure in x-direction we will still have a correlation between the $| \uparrow_x \rangle$ and $| \downarrow_x \rangle$ measurement results of two entangled qubits. The same is true for y-direction. Thus, this is not only about a one-dimensional correlation. And, it is not about where are physically our qubits: they can be in a fixed position, they can be at some distance and no matter what the measurement results should be the same.
+ +For more, I highly recommend this lecture by Allan Adams (about separable states and entangled states from 28:33-36:02) and this video from Veritasium youtube channel.
+",9459,,9459,,3/15/2020 13:00,3/15/2020 13:00,,,,0,,,,CC BY-SA 4.0 +10201,2,,10185,3/15/2020 13:38,,3,,"If you start with one graph state, which is an eigenstate of stabilizer (each of which comprises an X tensored with a bunch of Zs), then the other eigenstates of those stabilizers are the original state acted on by Z rotations (take all possible combinations). To see this note the commutation and anticommutation relations between a tensor product of Zs and each stabilizer.
+ +Consider a stabilizer of the form $K_n=X_nZ_iZ_j\ldots Z_k$, i.e. a graph-state stabilizer with a Pauli $X$ on qubit $n$, and a bunch of $Z$s on some other qubits (related to the graph structure). By definition, the graph state satisfies +$$ +K_n|\psi\rangle=|\psi\rangle +$$ +for all $n$. Now, let +$$ +|\Psi_x\rangle=\left(\bigotimes_{i=1}^nZ^{x_i}\right)|\psi\rangle, +$$ +for $x\in\{0,1\}^n$, a binary string. If we apply the stabilizers to such a state, we get +$$ +K_n|\Psi_x\rangle=K_n\left(\bigotimes_{i=1}^nZ^{x_i}\right)|\psi\rangle=\left\{\begin{array}{cc} +\left(\bigotimes_{i=1}^nZ^{x_i}\right)K_n|\psi\rangle & x_n=0 \\ +-\left(\bigotimes_{i=1}^nZ^{x_i}\right)K_n|\psi\rangle & x_n=1 +\end{array}\right. +$$ +Thus, every $|\Psi_x\rangle$ is an eigenstate of every stabilizer, and with a different pattern of $\pm 1$ eigenvalues (and must therefore be mutually orthogonal).
+ +While it must be the case that the different states $|\Psi_x\rangle$ are orthogonal, I think it's useful to think about this in terms of the way that the graph states are created. Remember that $|\psi\rangle$ is created from qubits in the $|+\rangle$ state and then have controlled-phase gates applied between them. Now, if I evaluate $\langle\Psi_y|\Psi_x\rangle$, think of this as a calculation +$$ +\langle+|^{\otimes n}CP\cdot Z_{x\oplus y}\cdot CP|+\rangle^{\otimes n} +$$ +where $CP$ represents the collection of controlled phase gates. Pauli $Z$ commutes with controlled phase, which means we can bring the two CPs together and annihilate them, leaving behind +$$ +\langle+|^{\otimes n} Z_{x\oplus y}|+\rangle^{\otimes n}. +$$ +Given that $x\neq y$, there is at least one $Z$, and we know $\langle +|Z|+\rangle=\langle -|+\rangle=0$.
+ +This way of thinking gives another way of describing the basis of graph states: prepare each qubit in either $|+\rangle$ or $|-\rangle$, and combine with controlled-phases. Each different choice of $\pm$ gives a different graph state in the basis.
+",1837,,1837,,3/16/2020 10:19,3/16/2020 10:19,,,,3,,,,CC BY-SA 4.0 +10202,1,10205,,3/16/2020 10:23,,4,79,"In the paper ""Quantum Expectation-Maximization for Gaussian Mixture Models"" I encountered the following proposition :
+ +Consider two vectors x,y and $\theta$ the angle between x and y, $\theta < \frac{\pi}{2}$. Then $||x - y|| \leq \epsilon$ implies $|| |x\rangle - |y\rangle || \leq \frac{\sqrt 2 \epsilon}{||x||}$.
+ +I'm not sure how to interpret the link between $x$ and $| x \rangle $ ? +In the case x is an integer, for example $x = 4$ then I'd say that $| x \rangle = | 100 \rangle $. But what about $x = 3.5$ or $x = (2.5, 2.5)$ ? +In those cases what $| x \rangle$ would be ?
+",10065,,,,,3/16/2020 12:58,How should I understand the link between $x$ and $| x \rangle $?,What I have obtained by running 4 times the same code on ""qasm_simulator"":
+ +{'00': 4656, '01': 1613, '10': 185, '11': 1642}
+{'00': 4564, '01': 1735, '10': 179, '11': 1618}
+{'00': 4581, '01': 1646, '10': 184, '11': 1685}
+{'00': 4602, '01': 1684, '10': 181, '11': 1629}
+
+
+Here we don't have noise, but still, the results are different. So, one can expect some variance between the results. In your results, the noisiest result was from +Burlington, then from Melbourne (for Melbourne the reason can be found in this answer). The rest QCs weren't performing comparably bad. You can try to apply the technique that you have used in this question or look to this tutorial for repetition codes. Still, their performance will depend on the circuit depth that you have.
+ +Other suggestions
+ +The noise crucially depends on the depth of your circuit. When I tried to run the code on Essex I saw that the gate number was 14 (7 CNOTs that contribute to the noise more than single-qubit gates). We always should try to minimize the gate number. For example, there were three CNOTs at the end of the circuit that implements the swap gate from QFT and they can be deleted, because specifically, for this case, they just swap the output results that can be done by post-processing by a classical computer.
+ +Also, there can be errors that can be tolerated depending on the algorithm that you use, and in those cases, one even shouldn't worry about the noise.
+",9459,,9459,,3/16/2020 12:38,3/16/2020 12:38,,,,0,,,,CC BY-SA 4.0 +10205,2,,10202,3/16/2020 12:58,,5,,"Generally it's context-specific what the label means. For example, if $x$ and $y$ are integers, then if $x\neq y$ then $|x\rangle$ and $|y\rangle$ are orthogonal (since they are different binary strings).
+ +I haven't read the paper you mentioned but in the ""Preliminaries"" section of 3.1, they describe what they mean by $| x\rangle$. Specifically: They assume $x\in \mathbb{R}^d$, and they define +$$|x\rangle = \frac{1}{\Vert x\Vert}\sum_{j=1}^d x_j|j\rangle$$
+ +So the $|j\rangle$ will be computational basis vectors, i.e. for $j=1$, $|j\rangle = |0\dots 01\rangle$, etc. The components of $x$ give the amplitudes of each of those basis vectors in some superposition.
+ +With this definition of $|x\rangle$, the ""Claim 3.4"" should follow.
+",4517,,,,,3/16/2020 12:58,,,,1,,,,CC BY-SA 4.0 +10206,2,,10194,3/16/2020 14:13,,1,,"I contacted @fran-cabrera from the IBMQ team and he could reproduce the bug!
+ +The problem is with the visualization of the transpiled circuit, not the execution (the result should be correct). The team is working on solving it and they expect to deploy a fix at the end of the week.
+ +I ran you example in Qiskit and it seems to work
+ + + +IBMQ.load_account()
+provider = IBMQ.get_provider(group='open')
+device = provider.get_backend('ibmq_16_melbourne')
+
+qasm_string = """"""
+OPENQASM 2.0;
+include ""qelib1.inc"";
+qreg q[3];
+creg c[3];
+h q[1];
+cx q[1],q[2];
+cx q[0],q[1];
+h q[0];
+measure q[1] -> c[1];
+if(c==1) x q[2];
+measure q[0] -> c[0];
+if(c==1) z q[2];
+measure q[2] -> c[2];
+""""""
+
+circuit = QuantumCircuit.from_qasm_str(qasm_string)
+circuit.draw('text')
+
+
+ ┌───┐┌─┐
+q_0: |0>─────────────■───┤ H ├┤M├──────────
+ ┌───┐ ┌─┴─┐ └┬─┬┘└╥┘
+q_1: |0>┤ H ├──■───┤ X ├──┤M├──╫───────────
+ └───┘┌─┴─┐ ├───┤ └╥┘ ║ ┌───┐ ┌─┐
+q_2: |0>─────┤ X ├─┤ X ├───╫───╫──┤ Z ├─┤M├
+ └───┘ └─┬─┘ ║ ║ └─┬─┘ └╥┘
+ ┌──┴──┐ ║ ║ ┌──┴──┐ ║
+ c_0: 0 ══════════╡ ╞══╬═══╩═╡ ╞═╬═
+ │ │ ║ │ │ ║
+ c_1: 0 ══════════╡ = 1 ╞══╩═════╡ = 1 ╞═╬═
+ │ │ │ │ ║
+ c_2: 0 ══════════╡ ╞════════╡ ╞═╩═
+ └─────┘ └─────┘
+
+
+result = transpile(circuit,
+ backend=provider.get_backend('ibmq_16_melbourne'),
+ seed_transpiler=42)
+result.draw('text', idle_wires=False)
+
+
+ ┌──────────┐┌─┐
+q_0 -> 0 |0>────────────────────────■───────┤ U2(0,pi) ├┤M├─────────────
+ ┌──────────┐ ┌─┴─┐ └───┬─┬────┘└╥┘
+q_1 -> 1 |0>┤ U2(0,pi) ├──■───────┤ X ├─────────┤M├──────╫──────────────
+ └──────────┘┌─┴─┐┌────┴───┴────┐ └╥┘ ║ ┌────────┐┌─┐
+q_2 -> 2 |0>────────────┤ X ├┤ U3(pi,0,pi) ├─────╫───────╫─┤ U1(pi) ├┤M├
+ └───┘└──────┬──────┘ ║ ║ └───┬────┘└╥┘
+ ┌──┴──┐ ║ ║ ┌──┴──┐ ║
+ c_0: 0 ═════════════════════╡ ╞═════════╬═══════╩══╡ ╞═══╬═
+ │ │ ║ │ │ ║
+ c_1: 0 ═════════════════════╡ = 1 ╞═════════╩══════════╡ = 1 ╞═══╬═
+ │ │ │ │ ║
+ c_2: 0 ═════════════════════╡ ╞════════════════════╡ ╞═══╩═
+ └─────┘ └─────┘
+
+
+Based on this, I think your example should work in the IQX jupyter notebooks, included in the IBM Quantum Experience.
+",1859,,,,,3/16/2020 14:13,,,,1,,,,CC BY-SA 4.0 +10207,2,,4707,3/16/2020 22:14,,2,,"Regarding (c) -
+ +Too see what can go wrong, we'll need to take a step back and look at Shor's Algorithm assumptions.
+ +Basically, the algorithm says we need to pick a random $X$, find its order $r$, and finally calculate $X^\frac{r}{2} \pmod N$ to get information about $N$.
+ +$N$ is of the form $2P$, thus by Chinese Remainder Theorm it will only have two roots modulo $N$, and they will have to be the trivial roots $1$ and $N-1$. That happens because $2$ has only one trivial root, unlike other primes.
+ +Thus for any $X$ you may pick, $X^\frac{r}{2} \equiv \pm 1 \pmod N$, so you will always end up with the trivial roots, which are not enough for deriving factors of $N$ (not even the factor $2$!)
+ +Reference - vazirani lecture on Shor's Algorithm
+",10385,,,,,3/16/2020 22:14,,,,0,,,,CC BY-SA 4.0 +10208,1,,,3/17/2020 5:14,,3,46,"I am trying to derive the Bloch vector $dr$ for a measurement of a observable in any arbitrary direction $\theta$. For context this is the setup and derivation I have for continuous measurement along the $z$ axis.
+ +The equation of continuous measurement on observable X has the following form:
+ +$\frac{d \rho}{d t}=\mathcal{D}[X] \rho+\sqrt{\eta} \mathcal{H}[X] \rho \xi(t)$
+ +$\mathcal{D}[X] \rho=X \rho X^{\dagger}-\frac{1}{2}\left(X^{\dagger} X \rho+\rho X^{\dagger} X\right)$
+ +$\mathcal{H}[X] \rho=X \rho+\rho X-\left\langle X+X^{\dagger}\right\rangle \rho$
+ +Kappa is the measurement strength.
+ +In Bloch Vector form,
+ +$\rho=\frac{1}{2}\left(I+x \sigma_{x}+y \sigma_{y}+z \sigma_{z}\right)$
+ +Then,
+ +$\mathcal{D}[X] \rho=2 \kappa\left(\sigma_{z} \rho \sigma_{z}-\rho\right)$
+ +$\mathcal{H}[X] \rho=\sqrt{2 \kappa}\left(\sigma_{z} \rho+\rho \sigma_{z}-2 z \rho\right)$
+ +To find $dx$
+ +$\frac{d x}{d t}=\frac{d T r\left(\sigma_{x} \rho\right)}{d t}=2 \kappa\left(\operatorname{Tr}\left(\sigma_{z} \sigma_{x} \sigma_{z} \rho\right)-x\right)+\sqrt{2 \kappa \eta}\left(\operatorname{Tr}\left(\left(\sigma_{x} \sigma_{z}+\sigma_{z} \sigma_{x}\right) \rho\right)-2 x z\right) \xi(t)$
+ +$=-4 \kappa x-\sqrt{8 \kappa \eta} x z \xi(t)$
+ +$\frac{d z}{d t}=\frac{d \operatorname{Tr}\left(\sigma_{z} \rho\right)}{d t}=2 \kappa\left(\operatorname{Tr}\left(\sigma_{z}^{2} \rho \sigma_{z}\right)-\operatorname{Tr}\left(\sigma_{z} \rho\right)\right)+\sqrt{2 \kappa \eta}\left(\operatorname{Tr}\left(\sigma_{z}^{2} \rho+\sigma_{z} \rho \sigma_{z}\right)-2 z \operatorname{Tr}\left(\sigma_{z} \rho\right)\right) \xi(t)$
+ +$=\sqrt{8 \kappa \eta}\left(1-z^{2}\right) \xi(t)$
+ +Now I am trying to find the $\frac{d z}{d t}$ and $\frac{d x}{d t}$, in the case that the $\mathcal{D}[X]$ and $\mathcal{H}[X]$ terms for the same master equation where becomes $X = \cos(\Theta )\sigma _z+\sin(\Theta )\sigma_x$ along measurement angle $\theta$ are:
+ +$\mathcal{D}[X] \rho=X \rho X^{\dagger}-\frac{1}{2}\left(X^{\dagger} X \rho+\rho X^{\dagger} X\right)$
+ +$= \cos^2(\Theta )\sigma _z\rho \sigma _z+\sin^2(\Theta )\sigma _x\rho \sigma _x$
+ +I am confused on what the simplified form of $\mathcal{H}[X]\rho$ will be as my simplification skills are not very strong
+ +I would also need help in finding $\frac{d T r\left(\sigma_{x} \rho\right)}{d t}$ and $\frac{d T r\left(\sigma_{z} \rho\right)}{d t}$ with the $\sin$ and $\cos$ terms like the above simplification.
+",10390,,55,,10/27/2020 9:13,10/27/2020 9:13,Deriving Bloch vector $dr$ from master equation,I've started learning Quantum Computing from the Qiskit Textbook and was able to easily understand or work out everything until it came to the working of Quantum Teleportation
+ +I can understand the procedure of it, but cannot understand why it works and was unable to work out the math of it. I also couldn't find any source that explained this is in a more simplistic manner.
+ +Here's the procedure that I have copy-pasted from the textbook:
+ +++",10376,,55,,4/17/2022 8:23,4/17/2022 8:23,How does quantum state teleportation works?,Step 1: Alice and Bob create an entangled pair of qubits and each one + of them holds on to one of the two qubits in the pair.
+ +The pair they create is a special pair called a Bell pair. In quantum + circuit language, the way to create a Bell pair between two qubits is + to first transfer one of them to the Bell basis ( |+⟩ and |−⟩ ) by + using a Hadamard gate, and then to apply a CNOT gate onto the other + qubit controlled by the one in the Bell basis.
+ +Let's say Alice owns q1 and Bob owns q2 after they part ways.
+ +Step 2: Alice applies a CNOT gate on q1 , controlled by |ψ⟩ (the + qubit she is trying to send Bob).
+ +Step 3: Next, Alice applies a Hadamard gate to |ψ⟩ , and applies a + measurement to both qubits that she owns - q1 and |ψ⟩ .
+ +Step 4: Then, it's time for a phone call to Bob. She tells Bob the + outcome of her two qubit measurement. Depending on what she says, Bob + applies some gates to his qubit, q2 . The gates to be applied, based + on what Alice says, are as follows :
+ +00 → Do nothing
+ +01 → Apply X gate
+ +10 → Apply Z gate
+ +11 → Apply ZX gate
+ +Note that this transfer of information is classical.
+ +And voila! At the end of this protocol, Alice's qubit has now + teleported to Bob.
+
You say you understand the first step where two-qubit unitaries just convert the single-qubit states into lots of sets of two-qubit states. Good.
+ +Now, you should also work backwards, from the end of the circuit. The rest of the circuit is another layer of two-qubit unitaries followed by single-qubit measurements. Well, you can change that by incorporating the two together. (For example, Hadamard followed by Z-measurement is the same as X-measurement.) So, those change into two-qubit measurements because, by the same argument as the forward reasoning, the single-qubit states that are projected on are converted into sets of two-qubit states.
+ +The only issue is how to combine the two-qubit states we've produced with two-qubit measurements. Of course, if any two-qubit states and two-qubit measurements match up perfectly, we can take those out straight away and calculate the probabilities of the different outcomes. So, now imagine what happens if you've got two-qubit states on pairs of qubits $(1,2)$ and $(3,4)$, but we want to do a measurement on qubits $(2,3)$. Well, we write down the 4-qubit state across $(1,2,3,4)$ and apply the measurement. Whatever the outcome (of which there are 4, you you can calculate their probabilities), just pick one, and the output state is a pair of qubits $(1,4)$. Now repeat. For example, you might have another entangled state on qubits $(5,6)$, and want to perform a measurement on $(4,5)$. So, this is exactly the same scenario, which we just repeat the same calculation. Eventually, we've done all the calculations.
+ +While it's not exactly the same, you may also be interested to read the section ""Linearly assembled quantum states can be efficiently simulated on a classical computer"" in this paper, which is where I learned about similar ideas.
+ +In terms of what happens if you add something to the depth of the circuit, well think about trying to take into account two layers of unitaries on the initial state. The first layer makes two-qubit states as before. The second layer might then combine them together. It could combine all of them together (consider, for example, a set of qubits arranged along a line, each in the $|+\rangle$ state. You first perform controlled-phase gates between pairs $(2n-1,2n)$. Then you perform controlled-phase gates between pairs $(2n,2n+1)$ in the second layer. This state is completely entangled; there is no separability. So the described strategy cannot work (although that doesn't rule out other simulation strategies).
+",1837,,1837,,3/17/2020 8:38,3/17/2020 8:38,,,,0,,,,CC BY-SA 4.0 +10211,2,,4252,3/17/2020 9:51,,0,,"firstly write CNOT⊗𝐼2 matrix, then change the order of index2 and index3 with matlab. in this way, you can do any number of qubits.
+",10392,,,,,3/17/2020 9:51,,,,1,,,,CC BY-SA 4.0 +10212,1,13915,,3/17/2020 12:36,,7,1277,"There is a lot of quantum gates in IBM Q Composer, however, only few are implemented physically while others can be composed of them.
+ +When one looks at description of a quantum processor in IBM Q interface, there is a list of basis gates. For example those are id, u1, u2, u3, cx
for Melbourne processor. However, gates $I$, $U1$ and $U2$ are special cases of $U3$. If one removes statement include ""qelib1.inc"";
from QASM code, only $CNOT$ and $U3$ gates are left. So, it seems that all single qubit gates are implemented with $U3$ and there is of course two qubits $CNOT$.
According to IBM Q manual, $U3$ gate is implemented by three frame changes and two $X_{\pi/2}$ pulses.
+ +My questions are these:
+ +I want to calculate eigenvectors and eigenvalues for real symmetric matrix or Hermitian matrix. Can I use this: https://qiskit.org/documentation/api/qiskit.aqua.components.eigs.Eigenvalues.html
+",10395,,9006,,3/17/2020 17:43,3/22/2020 21:11,Eigenvalue and eigenvector in Qiskit,I know that we can measure a state in standard basis (Z) where the post measurement state is either $|0\rangle$ or $|1\rangle$. But can you do a 'half-Z' basis measurement? I mean, you only measure with $|0\rangle \langle0|$ or $|1\rangle \langle1|$. So that when you measure $|+\rangle$, you would get $|0\rangle$ or $|1\rangle$ with equal probability. But if you measure $|0\rangle$ in $|1\rangle \langle1|$, then you would not get a detection with certainty. Is there any implementation of this sort of a 'half-basis'?
+",2403,,55,,10/27/2020 9:13,10/27/2020 9:13,Half of Standard Basis Measurement,I have a circuit with different structures, now I'm trying to calculate the fidelity between those with the original one. How do I calculate the fidelity? I want also to initialize the state vector by myself. Can someone show how to compute fidelity for the below example?
+ +For example if I have a circuit like below,
+ +q = QuantumRegister(2)
+qc = QuantumCircuit(q)
+qc.cu1(3*pi/4, q[0], q[1]);
+print(qc)
+
+
+and different structure
+ +q = QuantumRegister(2)
+qc = QuantumCircuit(q)
+qc.h(q[0]);
+qc.h(q[1]);
+qc.cu1(3*pi/4, q[0], q[1]);
+qc.h(q[0]);
+qc.h(q[1]);
+print(qc)
+
+",9778,,5955,,3/18/2020 8:09,8/29/2021 3:27,How to calculate state fidelity in Qiskit?,(This is related to Exercise 4.44 in Nielsen and Chuang)
+ +Deutsch quantum gate is basically a $iR_x(\alpha \pi)$ gate with two control qubits. The constant $\alpha$ is an irrational number that allows to perform any rotation $R_x (\theta)$ by sending $|11\rangle$ to the control qubits. In particular, one can (approximately) construct the set $\{ X, CNOT, \text{Toffoli} \}$ by choosing
+ +$$\alpha \pi \, \approx \, \pi \mod 2\pi,$$
+ +such that $R_x(\alpha \pi) \approx X$. My question is: how do you reach quantum universality? I guess you should be able to construct the Hadamard ($H$) and phase ($S$) gates, which together with $CNOT$ and Toffoli give quantum universality. Or else you should be able to construct $R_z(\theta)$ since $R_z(\alpha) R_x(\beta) R_z(\gamma)$ or $R_x(\alpha) R_z(\beta) R_x(\gamma)$ give any one-qubit unitary.
+",9895,,9006,,3/17/2020 22:34,8/16/2021 10:02,Why is Deutsch's gate universal?,What you're talking about is called a ""projection"". The projection onto basis state $|\psi\rangle$ is given by:
+ +$P_{\psi} = |\psi\rangle\langle\psi|$.
+ +Any measurement operator $M$, such as $Z$ can be written as the sum over projectors, weighted by their respective eigenvalues, such that
+ +$M = \sum_i \lambda_i P_i$
+ +where $\lambda_i$ is the real-valued eigenvalue associated with outcome $i$, and $\{i\}$ is a set of orthogonal states such that $P_iP_j = \delta_{ij}$. A measurement basis is said to be complete if it has the property
+ +$\sum_i P_i = I$
+ +and hence $\{i\}$ forms an orthonormal basis. What you are describing is an ""incomplete"" measurement basis. Because such an operator does not span a complete basis of the space, one property of such a measurement operator is that the sum of probabilities associated with its measurement is less than one (when taken over all input states).
+ +So, that's some maths, but what does this mean physically? If you imagine a photon in one of two waveguides, such that the $|0\rangle$ state is associated with it being in one waveguide and $|1\rangle$ in the other, then the measurement of the $Z$ operator is as simple as putting a detector at the end of each waveguide. In the case where your measurement operator is only $|0\rangle\langle 0|$, this equates to a system where you only have a a single detector at the end of the first waveguide.
+ +What happens then? Well, what you would expect, if you put in a $|0\rangle$ state, you detect it with probability 1. On the other hand, you never detect the $|1\rangle$ state. Similarly, in the case of $|+\rangle$, you detect a photon in the first waveguide half of the time.
+ +I guess the question that leaves us is how to think of this. Personally, I wouldn't think of it like a half-measurement, but just that you have measurement apparatus that has spans a limited basis and so the information it gathers over other basis states is simply incomplete. In the real world, this is always the case anyway. In the aforementioned photon experiment, it is often the case that no photon arrives at either detector due to a scattering event, and at the end of the day all this is telling us is that the measurement apparatus simply doesn't span the set of all possible states the system can take.
+",391,,,,,3/18/2020 6:03,,,,0,,,,CC BY-SA 4.0 +10218,2,,10215,3/18/2020 9:23,,3,,"There is more information towards the end of the tutorial here but essentially how you do this is you run both circuits on the state_vector
simulator and then you can use the function state_fidelity
to work out the fidelity between the two states.
The code to do this should look something like this
+from qiskit.quantum_info import state_fidelity
+
+# set up qc1 and qc2
+
+backend = Aer.get_backend('statevector_simulator')
+
+sv1 = execute(qc1, backend).result().get_statevector(qc1)
+sv2 = execute(qc2, backend).result().get_statevector(qc2)
+
+print(state_fidelity(sv1, sv2))
+
+",5955,,18113,,8/29/2021 3:27,8/29/2021 3:27,,,,2,,,,CC BY-SA 4.0
+10220,2,,10216,3/18/2020 10:14,,7,,"I have thoughts on a couple of different approaches, although I'm sure there'll be simpler options.
+ +Firstly, imagine you start from a two-qubit state $|00\rangle$, and apply an $R_x$ rotation with an angle equivalent to half that of a Pauli $X$ to the first qubit (I forget which convention N&C is using for their rotation gates). Then apply a controlled-not controlled off the first qubit and targeting the second qubit. Next, apply the inverse of the first rotation. Finally, measure the first qubit. If you get answer $|1\rangle$, the second qubit is in the $|-\rangle$ state. If it isn't, discard and repeat. So, we can produce the $|-\rangle$ state. If you input this as the target qubit of the controlled-controlled-$R_x$ (of arbitrary rotation angle), and have one of the controls in the $|1\rangle$ state, you get an arbitrary $Z$ rotation on the other control qubit.
+ +So, we know we can do arbitrary $X$ and $Z$ rotations, meaning that you can make any single-qubit unitary. Combine that with controlled-not and you know you have universality.
+ +A second approach that I had in mind (I've not worked out the details) is to go for encoded universality, in much the same way as you can use to show that computation with real amplitudes is universal. To sketch the idea: for a computation on $N$ logical qubits, you need $N+1$ physical qubits. The extra qubit is a phase register, so if you have $|x\rangle(\cos\theta|0\rangle+\sin\theta|1\rangle)$, that is equivalent to $e^{i\theta}|x\rangle$ in a regular quantum computation (this is the real computation version. I think the definition will need to change slightly here). Now $X$ rotations and controlled-nots are performed exactly as they normally would be in the first $N$ qubits. However, a phase gate is now implemented by a controlled-$X$ rotation, controlled of the qubit that's supposed to be acquiring the phase, targeting the phase qubit. If you can achieve that set of gates, you should be able to compose that for universality.
+",1837,,1837,,3/18/2020 13:35,3/18/2020 13:35,,,,8,,,,CC BY-SA 4.0 +10221,2,,10216,3/18/2020 12:22,,4,,"A classical proof involves Lie algebra to show that the Deutsch's three Qubits gate is universal for three qubits gates and then showing that we can construct a $ n $ qubits Deutsch's gate using Toffoli gates and three qubits Deutsch's gate only, so the results extends to $n$ qubits.
+You can find the proof in the caltech's course on quantum computation, page 29 to page 33. It's not an easy read (I mostly don't get it), but it seems complete. I hope it helps.
+Another lead going your way would be to prove that a combination of Deutsch's three qubits gate can reproduce the Hadamard gate as the set $\{H, T\}$ (with $H$ for Hadamard and $T$ for Toffoli) is universal (proof in A Simple Proof that Toffoli and Hadamard are Quantum Universal by Dorit Aharonov). However I'm not able to tell if a combination of Deutsch's three qubits gate can give a Hadamard gate, it's only speculative.
+",10065,,14843,,8/16/2021 10:02,8/16/2021 10:02,,,,0,,,,CC BY-SA 4.0 +10223,1,10224,,3/18/2020 13:19,,3,105,"In the Wikipedia's Quantum channel article, it is said that a purely quantum channel $\phi$ (it's not exactly the same phi calligraphy but it's close), in the Schrodinger picture, is a linear map between density matrices acting on two Hilbert spaces. Then properties of this mapping are given and we find the following notation :
+ +$$I_n \otimes \Phi$$ + We find again this difference of notation in the Heisenberg picture paragraph. +However I believe $\phi$ and $\Phi$ are the same and I don't understand the change of notation between the twos. Is there a difference justifying this change or is it a lack of coherence of the notation ?
+",10065,,9006,,3/18/2020 14:38,3/18/2020 14:54,Confusing notation in Wikipedia's quantum channel article,I think it's just notational inconsistency. If you look at the page code, the symbols are generated in two different ways: in the text, someone has just inserted the greek letter symbol (presumably a unicode character) whereas in the equation, they've used LaTeX. They're clearly both supposed to be capital phi.
+",1837,,,,,3/18/2020 14:54,,,,1,,,,CC BY-SA 4.0 +10225,1,,,3/18/2020 18:50,,2,25,"Currently, I'm learning about topological quantum computers.
+ +In one of the explained techniques, cooper pairs in superconductors are considered, where a cooper pair with a hole form a Majorana bound state. The pair is at the zero energy level, and as non-zero energies are not allowed, this should protect the Majorana bound state. However, as we have a pair, it is possible for the particles to each have a non-zero and opposite energy. Effectively the total energy is still zero, but each of the particles has non-zero energy.
+ +If we bring these particles far apart, there will be no interaction between them. Consequently, each of the two cannot move to a non-zero energy, as that would violate the particle-hole symmetry.
+ +What I don't understand is: +How can the particles be considered independent, such that their energy is protected and the particle remains at zero energy, while we still have the Majorana properties from the interaction of the two particles?
+",2005,,9006,,3/18/2020 22:18,3/18/2020 22:18,Why does non-locality and the particle-hole symmetry not contradict each other?,DaftWullie's answer outlines the idea pretty well, so I wanted to provide some more specifics on the fundamental gadget he describes and lay it out a bit more methodically.
+ +Once the first step is performed, there exists a quantum state that is distributed over a set of qubits where qubits are at most pairwise entangled. If we now consider simulating the application of an arbitrary set of two and one qubit measurements to this state, then there are six different cases:
+ +For 1, it is easy to see that this is classically simulable, since there are only two probabilities to calculate. Once these are calculated, the target qubit is no longer relevant and may be ignored by the simulation.
+ +For 2, there are similarly only two probabilities to calculate, except this time, the measurement leaves a single qubit, which may be part of another measurement that can be part of a future instance of cases 1, 3, or 5.
+ +For 3 and 4, since only four states are needed to span a two-qubit measurement basis, there are only four possible probabilities to calculate, regardless of whether the state is entangled or not. Similarly to 1, once these probabilities are calculated, both qubits may be ignored.
+ +For 5, again, only four probabilities need be calculated, but this time, after the measurement, a single qubit remains, which similarly can be part of a future instance of cases 1, 3, or 5.
+ +For 6, we also have four probabilities that need calculating, except now we have the case that the state which exists on the two remaining qubits which are not part of the measurement. This phenomena is known as ""entanglement swapping"". Hence, in the simulation, we apply the measurement and create a two-qubit entangled state that can then be part of a future instance of cases 2, 4, or 6.
+ +So the algorithm goes as follows:
+ +Adding a third layer breaks this because now it is possible to create a state which is more than pair-wise entangled on which universal quantum computation can be performed. To see this, observe that such a protocol is equivalent to three stages of pairwise entanglement followed by a round of single-qubit measurements. It can then be seen that three such entangling stages are sufficient to produce the trivalent hexagonal cluster state lattice, a state which is universal for measurement-based quantum computation [1] (along with single-qubit measurements and classical communications). Once we have such a state, the final stage could then be used to perform a universal measurement-based quantum computation. Hence, if it were possible to simulate such states efficiently, we would be able to simulate quantum computers efficiently as well, which we do not expect to be true.
+ +[1] Van den Nest, Maarten, et al. ""Universal resources for measurement-based quantum computation."" Physical review letters 97.15 (2006): 150504. Link here.
+",391,,391,,3/21/2020 16:47,3/21/2020 16:47,,,,0,,,,CC BY-SA 4.0 +10228,1,,,3/19/2020 5:47,,1,238,"I am trying to implement Quantum Teleportation Algorithm on an actual device, I am using IBM-Q Jupyter notebook for the same purpose.
+ +The code is as follows:
+ +import qiskit as qk
+from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit
+from qiskit import execute, Aer
+from qiskit import IBMQ
+from qiskit.visualization import plot_histogram
+%config InlineBackend.figure_format = 'svg'
+
+def apply_secret_unitary(secret_unitary, qubit, quantum_circuit, dagger):
+ functionmap = {
+ 'x': quantum_circuit.x,
+ 'y': quantum_circuit.y,
+ 'z': quantum_circuit.z,
+ 'h': quantum_circuit.h,
+ 't': quantum_circuit.t
+ }
+ if dagger == 1:
+ functionmap['t'] = quantum_circuit.tdg
+
+ if dagger:
+ [functionmap[unitary](qubit) for unitary in secret_unitary]
+ else:
+ [functionmap[unitary](qubit) for unitary in secret_unitary[::-1]]
+
+secret_unitary = 'hzxhzhx'
+
+qc = QuantumCircuit(3, 1)
+'''
+qc[0] -> The qubit to be teleported
+qc[1] -> entangled state, possessed by alice
+qc[2] -> entangled state, possessed by bob
+'''
+
+apply_secret_unitary(secret_unitary, qc.qubits[0], qc, dagger = 0)
+qc.barrier()
+qc.h(1)
+qc.cx(1, 2)
+qc.barrier()
+qc.cx(0, 1)
+qc.h(0)
+qc.cx(1, 2)
+qc.cz(0, 2)
+apply_secret_unitary(secret_unitary, qc.qubits[0], qc, dagger = 1)
+qc.barrier()
+qc.measure(2, 0);
+qc.draw(output= 'mpl')
+
+IBMQ.load_account()
+provider = IBMQ.get_provider(hub='ibm-q')
+provider.backends()
+
+from qiskit.providers.ibmq import least_busy
+backend = least_busy(provider.backends(filters = lambda b: b.configuration().n_qubits >= 3 and
+ not b.configuration().simulator and
+ b.status().operational == True))
+job_exp = execute(qc, backend = backend, shots = 8192)
+exp_result = job_exp.result()
+
+exp_measurement_result = exp_result.get_counts()
+print(exp_measurement_result)
+plot_histogram(exp_measurement_result)
+
+
+The error which the following code gives is:
+ +IBMQJobApiError: ""'400 Client Error: Bad Request for url: https://api.quantum-computing.ibm.com/api/Network/ibm-q/Groups/open/Projects/main/Jobs/5e73033786653e0018a2364e/resultDownloadUrl. Cannot get presigned download url., Error code: 3202.'""
+
+
+I've tried deleting my account and load a new account using a newly generated token but that doesn't seem to work either.
+ +Clicking the link in the error gives the following error:
+ +OPERATION_NOT_AVAILABLE
+404 Shared class ""Hub"" has no method handling GET /ibm-q/Groups/open/Projects/main/Jobs/5e72ff01121d5e0018bfe775/resultDownloadUrl.
+code: 2411
+
+
+perhaps, I am using a method which is now deprecated. How can I tackle this situation?
+",10376,,,,,3/23/2020 14:53,Error while running Quantum Teleportation Algorithm on real device using qiskit on IBM-Q,EDIT: I believe this is solved in @IEIrodov's answer below.
+ +I'm not sure what's causing the issue, but based on similar issues on the qiskit slack channel, I don't think it's something you're doing.
+ +As a workaround, try running:
+ +exp_result = job_exp.result()
+exp_measurement_result = exp_result.get_counts()
+print(exp_measurement_result)
+plot_histogram(exp_measurement_result)
+
+
+Separately in a new cell.
+ +(also, if you're trying to verify teleportation, you need to apply_secret_unitary
on line 42 to qc.qubits[2]
instead of qc.qubits[0]
).
My goal is to prove that I can synthesise arbitrary unitary from two components.
+ +In the end, I find a matrix with the form +\begin{equation} + \mathbf{W}_j=\begin{pmatrix} + |\alpha|2\cos{(\phi_{k,2}+\phi_{k,1})}+i|\beta|2\cos{(\phi_{k,2}-\phi_{k,1})} & i|\alpha|2\sin{(\phi_{k,2}+\phi_{k,1})}+|\beta|2\sin{(\phi_{k,2}-\phi_{k,1})}\\ + i|\alpha|2\sin{(\phi_{k,2}+\phi_{k,1})}+|\beta|2\sin{(\phi_{k,2}-\phi_{k,1})} & + |\alpha|2\cos{(\phi_{k,2}+\phi_{k,1})}+i|\beta|2\cos{(\phi_{k,2}-\phi_{k,1})} + \end{pmatrix} +\end{equation} +where $\phi_{k,1}$,$\phi_{k,2}$,$\alpha$ and $\beta$ are parameters.
+ +Where can I begin to prove that it is an arbitrary unitary?
+",10417,,9006,,3/19/2020 12:13,3/19/2020 22:37,How to prove that a matrix is an arbitrary unitary?,I'm not sure what had caused the problem but I was able to solve it and most likely know what the problem was.
+ +Consider these two lines from my code above:
+ +job_exp = execute(qc, backend = backend, shots = 8192)
+exp_result = job_exp.result()
+
+
+Problem with the above lines is that we are not waiting for the actual quantum device to compute and send over the data. To avoid this, we can use a method called job_monitor
from qiskit.tools.monitor
which when called, let us know whether the job is complete or not.
After it displays that the job has successfully run we should expect value from result
Following is the code for the same purpose:
+ +IBMQ.load_account()
+provider = IBMQ.get_provider(hub = 'ibm-q')
+backend = least_busy(provider.backends(filters = lambda x: x.configuration().n_qubits >= 3
+ and not x.configuration().simulator
+ and x.status().operational == True))
+print('least busy backend: ', backend)
+
+
+from qiskit.tools.monitor import job_monitor
+job = execute(qc, backend = backend, shots = 8192)
+job_monitor(job)
+
+
+Proceed further only after the output to the above cell becomes 'Job Status: job has successfully run' which may take some time depending upon the value of shots.
+ +After that, you can call result() and get_counts() to get the values:
+ +result = job.result()
+counts = result.get_counts()
+
+",10376,,,,,3/19/2020 10:49,,,,0,,,,CC BY-SA 4.0
+10232,2,,10228,3/19/2020 11:00,,0,,"Error 3202 is a networking error when trying to get the requested page. In this case the results for your job.
+",332,,,,,3/19/2020 11:00,,,,0,,,,CC BY-SA 4.0 +10233,2,,10213,3/19/2020 11:02,,1,,"If that is all you want to do then SciPy is really the way to go. Indeed, qiskit just wraps that functionality when requesting a classical answer. +In SciPy you can use scipy.linalg.eig. You can find examples of using this function in the documentation.
+",332,,10352,,3/22/2020 21:11,3/22/2020 21:11,,,,2,,,,CC BY-SA 4.0 +10234,2,,10230,3/19/2020 15:37,,1,,"The straightforward method is to compute $ W W^\dagger = W^\dagger W = I $ and to get constraint over your parameters solving this system. I'm going to show you how to do it only for $ W W^\dagger = I$ but it should be very similar for $ W^\dagger W$. I assume here that all your parameters are real.
+ +first some notation for ease of reading, let's pose :
+ +$W = \begin{bmatrix} A & B \\ C & D \end{bmatrix} $, $W^\dagger = \begin{bmatrix} A^* & C^* \\ B^* & D^* \end{bmatrix}, I = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}$
+ +this allows us to see easily that : +\begin{align} AA^* + BB^* &= 1 \\ +CC^* + DD^* &= 1 +\end{align}
+ +using the property over product of complex conjuguates ($zz^* = |z|^2$), the computation for these two equalities is pretty straightforward.
+ +\begin{align} |A|^2 + |B|^2 &= 1 \\ +|C|^2 + |D|^2 &= 1 +\end{align}
+ +I let you the details of the computation (The trick is to remember that $cos^2(x) + sin^2(x)=1$) but in the end you should get :
+ +$$ |\alpha|^2+|\beta|^2 = \frac{1}{4}$$
+ +for the two equalities. That's your first constraint over your matrix for it to be unitary.
+ +Then you have the two following equalities :
+ +\begin{align} AC^* + BD^* &= 0 \\ +CA^* + DB^* &= 0 +\end{align}
+ +Those ones are a bit more expensive in time to compute, and I'm going to do only the first one. With some observations you can see that 4 terms cancels each other, making the computation quite fast. At the end you should get the equality (only difficulty is to remember the following formula, $\sin(a+b) = \sin(a)\cos(b) + \cos(a)\sin(b)$) :
+ +$$4 |\alpha||\beta| \sin(2 \phi_2) = 0$$
+ +which has multiple solutions :
+ +$(\phi_2 = z \frac{\pi}{2}, \alpha \in \mathbb{R}, \beta \in \mathbb{R}, z \in \mathbb{Z}),(\phi_2 \in \mathbb{R} , \alpha \in \mathbb{R}, \beta = 0), (\phi_2 \in \mathbb{R} , \alpha =0, \beta \in \mathbb{R}) $
+ +You can do the same for
+ +$$ CA^* + DB^* = 0$$
+ +and it should give you a new equality constraint over your parameters.
+ +For now we have the following non-linear system of constraint :
+ +\begin{align} |\alpha|^2+|\beta|^2 & = \frac{1}{4} \\ + |\alpha||\beta| \sin(2 \phi_2) & = 0 +\end{align}
+ +You now need to complete this system by finding new constraint with the last equality I left aside and the ones you'll get by computing $W^\dagger W = I$. I believe you'll get pretty close constraints, maybe one more over $\phi_1$.
+ +In the end you will get a non-linear system, it should not be too hard to solve by hand, if it is for you, you can use the very useful online systems of equations solver from Wolframalpha. The solutions of this non-linear system will tell you what range your parameters can take such that your matrix is unitary.
+",10065,,,,,3/19/2020 15:37,,,,5,,,,CC BY-SA 4.0 +10235,1,10238,,3/19/2020 19:11,,8,564,"In ZX-calculus, the CNOT gate is represented by this:
+ +Can someone show me why this is true, using just the basic rewriting rules? All books/papers I have seen simply take it without proof, but I can't see why it is true.
+",6118,,55,,7/25/2022 5:59,7/25/2022 5:59,Explain the representation of the CNOT gate in ZX-calculus,There are multiple ways to show that $W_j$ is not, in general, unitary. The easiest might be to look at the determinant. A basic property of unitary matrices is that their determinant has unit modulus. In this case the determinant reduces to +$$\text{det}(W_j)=4 \, (\vert \alpha \vert^2 - \vert \beta \vert ^2 + i2 \, \vert \alpha \vert \vert \beta \vert \cos(2\phi_{k,2})).$$ +There is nothing in the problem statement constraining this value to unit modulus, and I don't see any natural constraints that can be imposed to make it so.
+ +There are many other ways to show that $W_j$ is not generally unitary. Hopefully it's clear that if $W_j$ is not generally unitary, it's certainly not an arbitrary unitary.
+",8623,,9006,,3/19/2020 22:37,3/19/2020 22:37,,,,0,,,,CC BY-SA 4.0 +10238,2,,10235,3/19/2020 21:18,,10,,"I am going to assume that $|0\rangle$ is represented by , and $|1\rangle$ by
.
Then, represents the bit-flip, or NOT gate. What it does is: $|x\rangle\mapsto |x\oplus1\rangle$. This can be verified easily in the graphical calculus, using the ""spider"" rule:
and
+ + + +Now, by definition, CNOT controls NOT: $|x_1,x_2\rangle\mapsto|x_1,x_1\oplus x_2\rangle$. In other words, if $|0\rangle$ is fed to the first qubit, the result is $|0\rangle$ on the first qubit, and the identity on the second. If it is fed $|1\rangle$, the result is $|1\rangle$ on the first qubit, and the gate NOT on the second one. Again this can be verified in the graphical calculus:
+ + + +where the first equality is the ""copy"" rule, the second is the ""spider"" rule, and the last one is the fact that a rotation of angle $0$ is the identity.
+ +Similarly:
+ + + +where the first equality is the ""$\pi$-copy"" rule, and the second is the ""spider"" rule.
+",7422,,,,,3/19/2020 21:18,,,,1,,,,CC BY-SA 4.0 +10239,1,10243,,3/20/2020 5:38,,8,481,"I have a unitary matrix that I want to construct. I only care what happens to the first computational state, so the first column is specified. So far, I've been assigning each question mark to a variable and solving $UU^T = I$ analytically. But this 6x6 case is out of computational reach for this method.
+ +Is there any general method, or any clever trick, to help me fill in the rest of matrices such as $U$?
+ +Note: I actually would prefer if all the entries were real, so technically these are better called orthogonal matrices.
+ +$U = \frac{1}{\sqrt{5}}\begin{bmatrix} +0 & ? & ? & ? & ? & ? \\ +1 & ? & ? & ? & ? & ? \\ +1 & ? & ? & ? & ? & ? \\ +1 & ? & ? & ? & ? & ? \\ +1 & ? & ? & ? & ? & ? \\ +1 & ? & ? & ? & ? & ? \\ +\end{bmatrix} $
+",1867,,734,,3/21/2020 5:14,3/22/2020 4:16,How can I fill a unitary knowing only its first column?,1) This equation is at best confusing, and at worst perhaps even straight-up wrong. Firstly, they use a different edge contraction notation as in the equations description and secondly, as you observe, they appear to have a Z operator acting upon qubit $v^{\prime\prime}$ which is no longer a vertex of the edge-contracted state.
+ +Perhaps the Z-operators on various qubits do cancel out as desired when applied to the correct qubits, but this is clearly a confusing and non-obvious way of representing the state. Looking at it, I suspect that they have simply mixed up $v$ and $v^{\prime\prime}$, since the operator $Z^k_{v}Z^l_{N_G(v^{\prime\prime})\setminus \{v^\prime\}}$ looks correct to me.
+ +Assuming this is the case, the reason we can write the state like this can be seen by considering a simpler case. First, we observer that the two-vertex line graph $L_2$ can be written as:
+ +$$ +\def\ket#1{\lvert #1 \rangle}\def\bra#1{\langle #1 \rvert} +\ket{L_2} = \frac{1}{\sqrt{2}}(\ket{++} + \ket{--}) +$$
+ +whereas the state associated with the three-qubit line $L_3$ can be written as
+ +$$ +\begin{aligned} +\ket{L_3} &= \frac{1}{2}(\ket{+++} + \ket{+--} + \ket{--+} + \ket{-+-}) \\ +&= \frac{1}{2}\big[(\ket{++} + \ket{--})_{1,3}\ket{+}_2 + (\ket{+-} + \ket{-+})_{1,3}\ket{-}_2\big] \\ +&= \frac{1}{\sqrt{2}}\sum_{i=0,1}Z_3^i\ket{L_2}_{1,3}(\ket{0} + Z_2^i\ket{1}) +\end{aligned} +$$
+ +where $L_2 = L_3 \;/\; (1, 2)$. This equation is telling us that if we measure the middle qubit in the $X$-basis, we essentially perform an edge contraction on one of it's connected edges. It is easy to see that applying this twice yields their desired result.
+ +So yeah, my money is that it's just a typo.
+ +2) You are correct in asserting that the edge contraction trick would work with only two nodes (up to the $Z$ operators applied to the remaining state). The reason they do this is because the lemma's real purpose is for their proof of theorem 3, in which they seek to produce a graph $\tilde{G}$ of maximum vertex degree 3. This requires adding the extra internal vertex $v^\prime$ with degree two, since if one were not to do this, the subsequent expansions would not serve to reduce the overall degree.
+ +The best way to see this is to take the example given in Figure 1 and try the subsequent expansions of $v$ and $v^{\prime\prime}$ in the case where $v^\prime$ does and doesn't exist. In the latter case, the expansion of the right node serves to increase the degree of the original node, whereas in the former case the middle node goes from degree 2 to 3. If you repeat this enough times, you will soon see that the centre node is necessary to reduce the overall degree.
+",391,,,,,3/20/2020 6:41,,,,0,,,,CC BY-SA 4.0 +10241,1,10244,,3/20/2020 10:57,,1,128,"BB84 protocol works followingly:
+So, my question is how step 5 is done in practice? To reconcile the key, they have to exchange some information about it. I found that a hash function can be used for concealing information about the key from Eve as much as possible. However, if the information is hidden, how can Alice and Bob repair the key to ensure they have the same one?
+",9006,,7429,,1/21/2021 17:41,1/21/2021 17:41,How to deal with noise in BB84 protocol?,