ebook img

QCWAVE, a Mathematica quantum computer simulation update PDF

1.6 MB·
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview QCWAVE, a Mathematica quantum computer simulation update

QCWAVE - A MATHEMATICA QUANTUM COMPUTER SIMULATION UPDATE Frank Tabakina andBruno Juli´a-D´ıazb aDepartment of Physics and Astronomy 1 University of Pittsburgh, Pittsburgh, PA, 15260 1 0 bDepartament de Estructura i Constituents de la Materia 2 Universitat de Barcelona, 08028 Barcelona (Spain) n a J 0 Abstract 1 ] This Mathematica 7.0/8.0 package upgrades and extends the quantum computer h simulation code called QDENSITY. Use of the density matrix was emphasized in p - QDENSITY,althoughthatcodewasalsoapplicabletoaquantumstatedescription. t n In the present version, the quantum state version is stressed and made amenable to a future extensions to parallel computer simulations. The add-on QCWAVE extends u q QDENSITY in several ways. The first way is to describe the action of one, two and [ three- qubit quantum gates as a set of small (2×2,4×4 or 8×8) matrices acting on 1 the 2nq amplitudes for a system of nq qubits. This procedure was described in our v parallel computer simulation QCMPI and is reviewed here. The advantage is that 5 smallerstoragedemandsaremade,withoutlossofspeed,andthattheprocedurecan 8 7 take advantage of message passing interface (MPI) techniques, which will hopefully 1 be generally available in future Mathematica versions. . 1 Another extension of QDENSITY provided here is a multiverse approach, as de- 0 1 scribed in our QCMPI paper. This multiverse approach involves using the present 1 slave-master parallel processing capabilities of Mathematica 7.0/8.0 to simulate er- : v rors and error correction. The basic idea is that parallel versions of QCWAVE run i X simultaneously with random errors introduced on some of the processors, with an r ensemble average used to represent the real world situation. Within this approach, a error correction steps can be simulated and their efficacy tested. This capability allows one to examine the detrimental effects of errors and the benefits of error correction on particular quantum algorithms. Other upgrades provided in this version includes circuit-diagram drawing com- mands, better Dirac form and amplitude display features. These are included in the add-ons QCWave.m and Circuits.m, and are illustrated in tutorial notebooks. In separate notebooks, QCWAVE is applied to sample algorithms in which the parallel multiverse setup is illustrated and error correction is simulated. These ex- tensions and upgrades will hopefully help in both instruction and in application to QC dynamics and error correction studies. Preprint submitted to Elsevier 11 January 2011 Program Summary Title of program: QCWAVE. Catalogue identifier: Program summary URL: http://cpc.cs.qub.ac.uk/summaries Program available from: CPC Program Library, Queen’s University of Belfast, N. Ireland. Operating systems: Any operating system that supports Mathematica; tested under Microsoft Windows XP, Macintosh OSX, and Linux FC4. Programming language used: Mathematica 7.0. Number of bytes in distributed program, including test code and documenta- tion: xx Distribution format: tar.gz Nature of Problem:Simulationofquantumcircuits,quantumalgorithms,noise and quantum error correction. Method of Solution: A Mathematica package containing commands to create and analyze quantum circuits is upgraded and extended, with emphasis on state amplitudes. Several Mathematica notebooks containing relevant exam- ples are explained in detail. The parallel computing feature of Mathematica is used to develop a multiverse approach for including noise and forming suitable ensemble averaged density matrix evolution. Error correction is simulated. 2 1 INTRODUCTION In this paper, QDENSITY[1] (a Mathematica[2] package that provides a flexible simulation of a quantum computer) is extended and upgraded by an add-on called QCWAVE 1. The earlier flexibility in QDENSITY is enhanced by adopting a simple state vector approach to initializations, operators, gates, and measurements. Although the present version stresses a state vector ap- proach the density matrix can always be constructed and examined. Indeed, a parallel universe (or multiverse) approach is also included, using the present Mathematica 7.0/8.0 slave-master feature. This multiverse approach, which was published[5] in our QCMPI paper2, allows separate dynamical evolu- tions on several processors with some evolutions subject to random errors. Then an ensemble average is performed over the various processors to pro- duce a density matrix that describes a QC system with realistic errors. Error correction methods can also be invoked on the set of processors to test the efficacy of such methods on selected QC algorithms. In section2, we introduce qubit state vectors and associated amplitudes for one, two and multi-qubit states. In section3, a method for handling one, two and three- qubit operators acting on state vectors with commands from QCWAVE are presented. In section4, illustrations of how to apply gates to states are shown. In section 5, the multiverse approach is described and the parallel method for introduc- tion of errors and error correction are given. The ensemble averaged density matrix is then constructed. Additional upgrades, such as Dirac and amplitude displays and circuit draw- ing are presented in section6. Suggested applications are presented in the conclusion section7. 1 Other authors have also developed Mathematica/Maxima QDENSITY based quantum computing simulations[3,4]. Hopefully, they will incorporate the ideas we provide herein in their future efforts. 2 QCMPIisaquantumcomputer(QC)simulationpackagewritteninFortran90with parallel processing capabilities. 3 2 MULTI-QUBIT STATES 2.1 One-qubit states The basic idea of a quantum state, its representation in Hilbert space and the concepts of quantum computing have been discussed in many texts[6,7,8]. A brief review was given in our earlier papers in this series[1,5]. Here we proceed directly from one, two and multi-qubit states and their amplitudes to how various operators alter those amplitudes. To start, recall that when one focuses on just two states of a quantum system, such as the spin part of a spin-1/2 particle, the two states are represented as either | 0(cid:105) or | 1(cid:105). A one qubit state is a superposition of the two states associated with the above 0 and 1 bits: | Ψ (cid:105) = C | 0(cid:105)+C | 1(cid:105), (1) 1 0 1 where C ≡ (cid:104)0 | Ψ (cid:105) and C ≡ (cid:104)1 | Ψ (cid:105) are complex probability amplitudes 0 1 1 1 for finding the qubit in the state | 0(cid:105) or | 1(cid:105), respectively. The normalization of the state (cid:104)Ψ | Ψ (cid:105) = 1, yields | C |2 + | C |2= 1. Note that the spatial 1 1 0 1 aspects of the wave function are being suppressed; which corresponds to the particle being in a fixed location. The kets | 0(cid:105) and | 1(cid:105) can be represented as | 0(cid:105) → (1) and | 1(cid:105) → (0). Hence a 2 × 1 matrix representation of this 0 1 (cid:16) (cid:17) one-qubit state is: | Ψ (cid:105) → C0 . 1 C1 An essential point is that a quantum mechanical (QM) system can exist in a superposition of these two bits; hence, the state is called a quantum-bit or “qubit”. Although our discussion uses the notation of a system with spin 1/2, it should be noted that the same discussion applies to any two distinct quantum states that can be associated with | 0(cid:105) and | 1(cid:105). 2.2 Two-qubit states The single qubit case can now be generalized to multiple qubits. Consider the product space of two qubits both in the “up” | 0(cid:105) state and denote that product state as | 0 0(cid:105) =| 0(cid:105) | 0(cid:105), which clearly generalizes to | q q (cid:105) =| q (cid:105) | q (cid:105), (2) 1 2 1 2 where q ,q in general take on the values 0 and 1. This product is called a 1 2 tensor product and is symbolized as | q q (cid:105) =| q (cid:105)⊗ | q (cid:105). (3) 1 2 1 2 4 In QDENSITY, the kets | 0(cid:105),| 1(cid:105) are invoked by the commands Ket[0] and Ket[1], and the product state by for example | 00(cid:105) = Ket[0]⊗Ket[0]. The kets | 00(cid:105),| 01(cid:105),| 10(cid:105),& | 11(cid:105) can be represented as 4×1 matrices         1 0 0 0                 0 1 0 0         | 00(cid:105) →  ;| 01(cid:105) →  ;| 10(cid:105) →  ;| 11(cid:105) →  . (4)         0 0 1 0                 0 0 0 1 Hence, a 4×1 matrix representation of the two-qubit state | Ψ (cid:105) = C | 00(cid:105)+C | 01(cid:105)+C | 10(cid:105)+C | 11(cid:105), (5) 2 0 1 2 3 is:   C 0     C   1 | Ψ2(cid:105) →   . (6)   C2     C 3 Again C ≡ (cid:104)00 | Ψ (cid:105),C ≡ (cid:104)01 | Ψ (cid:105),C ≡ (cid:104)10 | Ψ (cid:105), and C ≡ (cid:104)11 | Ψ (cid:105), are 0 2 1 2 2 2 3 2 complex probability amplitudes for finding the two-qubit system in the states | q q (cid:105). The normalization of the state (cid:104)Ψ | Ψ (cid:105) = 1, yields 1 2 2 2 | C |2 + | C |2 + | C |2 + | C |2= 1. (7) 0 1 2 3 Note that we label the amplitudes using the decimal equivalent of the bit product q q , so that for example a binary label on the amplitude C is 1 2 10 equivalent to the decimal label C . 2 2.3 Multi-qubit states For n qubits the computational basis of states generalizes to: q | n(cid:105) ≡| q (cid:105)··· | q (cid:105) ≡| q q ··· q (cid:105) ≡| Q(cid:105). (8) nq 1 nq 1 2 nq We use the convention that the most significant qubit is labeled as q and the 1 least significant qubit by q . Note we use q to indicate the quantum number nq i of the ith qubit. The values assumed by any qubit is limited to either q = 0 i (cid:16) (cid:17) or 1. The state label Q denotes the qubit array Q = q ,q ,··· ,q , which 1 2 nq is a binary number label for the state with equivalent decimal label n. This 5 decimal multi-qubit state label is related to the equivalent binary label by nq n ≡ q ·2nq−1 +q ·2nq−2 +···+q ·20 = (cid:88) q ·2nq−i. (9) 1 2 nq i i=1 Note that the ith qubit contributes a value of q ·2nq−i to the decimal number i n. Later we will consider “partner states” (| n (cid:105), | n (cid:105)) associated with a given 0 1 n, where a particular qubit i has a value of q = 0, s is n = n−q ·2nq−is, (10) 0 is or a value of q = 1, is n = n−(q −1)·2nq−is. (11) 1 is These partner states are involved in the action of a single operator acting on qubit i , as described in the next section. s A general state with n qubits can be expanded in terms of the above compu- q tational basis states as follows 2nq−1 (cid:88) (cid:88) | Ψ(cid:105) = C | Q(cid:105) ≡ C | n(cid:105), (12) nq Q n Q n=0 wherethesumoverQisreallyaproductofn summationsoftheform(cid:80) . q qi=0,1 The above Hilbert space expression maps over to an array, or column vector, of length 2nq     C C 0 0···00         C  C   1   0···01  .   .  | Ψ(cid:105)nq ≡ ..  or with binary labels −→  ..  . (13)  .   .   ..   ..              C C 2nq−1 1···11 The expansion coefficients C (or C ) are complex numbers with the physical n Q meaning that C = (cid:104)n | Ψ(cid:105) is the probability amplitude for finding the n nq system in the computational basis state | n(cid:105), which corresponds to having the qubits pointing in the directions specified by the binary array Q. Switching between decimal n and equivalent binary Q labels is accomplished by the Mathematica command IntegerDigits. In general, the complex amplitudes C vary with time and are changed by the n action of operators or gates, as outlined next. 6 3 MULTI-QUBIT OPERATORS Operators that act in the multi-qubit space described above can be generated from a set of separate Pauli operators 3, acting in each qubit space. These separate Pauli operators refer to distinct quantum systems and hence they commute. Note, Pauli operators acting on the same qubit do not commute; indeed, they have the property σ σ −σ σ = 2 i (cid:15) σ . The Pauli operator σ i j j i ijk k 0 is just the unit 2×2 matrix. We denote a Pauli operator acting on qubit i as s σ(is), where k = (x,y,z) = (1,2,3) is the component of the Pauli operator. For k example, the tensor product of two qubit operators has the following structure (cid:104)a | σ | b (cid:105)(cid:104)a | σ | b (cid:105)=(cid:104)a a | σ(1)σ(2) | b b (cid:105) 1 i 1 2 j 2 1 2 i j 1 2 =(cid:104)a a | σ(1) ⊗σ(2) | b b (cid:105), (14) 1 2 i j 1 2 which defines what we mean by the tensor product of two qubit operators σ(1) ⊗σ(2). The generalization to more qubits is immediate i j (σ(1) ⊗σ(2))⊗(σ(3) ⊗σ(4))··· . (15) i j k l 3.1 One-qubit operators One-qubit operators change the amplitude coefficients of the quantum state. The NOT and Hadamard H are examples of one-qubit operators of particu- lar interest: NOT ≡ σ = (0 1) ,H ≡ σx√+σz = √1 (1 1 ) . These have the x 1 0 2 2 1 −1 following effect on the basis states NOT | 0(cid:105) =| 1(cid:105), NOT | 1(cid:105) =| 0(cid:105), and H | 0(cid:105) = |0(cid:105)√+|1(cid:105), and H | 1(cid:105) = |0(cid:105)√−|1(cid:105). 2 2 General one-qubit operators can also be constructed from the Pauli operators; we denote the general one-qubit operator acting on qubit s as Ω . Consider s the action of such an operator on the multi-qubit state | Ψ(cid:105) : nq (cid:88) Ω | Ψ(cid:105) = C Ω | Q(cid:105) (16) s nq Q s Q (cid:88) (cid:88) (cid:88) = ··· ··· C | q (cid:105)··· (Ω | q (cid:105)) ··· | q (cid:105). Q 1 s s nq q1=0,1 qs=0,1 qnq=0,1 (17) 3 The Pauli operators act in the qubit Hilbert space, and have the matrix repre- √ sentation: σ = (0 1) ; σ = (cid:0)0 −I(cid:1) ; σ = (cid:0)1 0 (cid:1). Here I ≡ −1 . x 1 0 y I 0 z 0 −1 7 Here Ω is assumed to act only on the qubit i of value q . The (Ω | q (cid:105)) term s s s s s can be expressed as Ω | q (cid:105) = (cid:88) | q(cid:48)(cid:105)(cid:104)q(cid:48) |Ω | q (cid:105), (18) s s s s s s q(cid:48)=0,1 s using the closure property of the one qubit states. Thus Eq.(17) becomes (cid:88) Ω | Ψ(cid:105) = C Ω | Q(cid:105) = (19) s nq Q s Q (cid:88) ··· (cid:88) ··· (cid:88) (cid:88) C (cid:104)q(cid:48) |Ω | q (cid:105) | q (cid:105)··· | q(cid:48)(cid:105)··· | q (cid:105). Q s s s 1 s nq q1=0,1 qs=0,1 qnq=0,1qs(cid:48)=0,1 Now we can interchange the labels q ↔ q(cid:48), and use the label Q to obtain the s s algebraic result for the action of a one-qubit operator on a multi-qubit state 2nq−1 (cid:88) ˜ (cid:88) ˜ Ω | Ψ(cid:105) = C | Q(cid:105) = C | n(cid:105), (20) s nq Q n Q n=0 where C˜ = C˜ = (cid:88)(cid:104)q |Ω | q(cid:48)(cid:105) C (21) Q n s s s Q(cid:48), q(cid:48)=0,1 s (cid:16) (cid:17) (cid:16) (cid:17) where Q = q ,q ,···q , and Q(cid:48) = q ,···q(cid:48) ···q . That is Q and Q(cid:48) are 1 2 nq 1 s nq equal except for the qubit acted upon by the one-body operator Ω . s A better way to state the above result is to consider Eq.(21) for the case that n has q = 0 and thus n → n and to write out the sum over q(cid:48) to get s 0 s ˜ C = (cid:104)0 |Ω | 0(cid:105)C +(cid:104)0 |Ω | 1(cid:105)C , (22) n0 s n0 s n1 where we introduced the partner to n namely n . For the case that n has 0 1 q = 1 and thus n → n Eq.(21), with expansion of the sum over q(cid:48) yields s 1 s ˜ C = (cid:104)1 |Ω | 0(cid:105)C +(cid:104)1 |Ω | 1(cid:105)C . (23) n1 s n0 s n1 or written as a matrix equation we have for each n ,n partner pair 0 1      ˜ C (cid:104)0 | Ω | 0(cid:105) (cid:104)0 | Ω | 1(cid:105) C  n0 =  s s  n0 (24)      ˜ C (cid:104)1 | Ω | 0(cid:105) (cid:104)1 | Ω | 1(cid:105) C n1 s s n1 This is not an unexpected result. Equation(24) above shows how a 2×2 one-qubit operator Ω acting on qubit s i changes the state amplitude for each value of n . Here, n denotes a decimal s 0 0 number for a computational basis state with qubit i having the q value zero s s 8 and n denotes its partner decimal number for a computational basis state 1 with qubit i having the q value one. They are related by s s n = n +2nq−is. (25) 1 0 At times, we shall call 2nq−is the “stride” of the i qubit; it is the step in s n needed to get to a partner. There are 2nq/2 values of n and hence 2nq/2 0 pairs n ,n . Equation (24) is applied to each of these pairs. In QCWAVE that 0 1 process is included in the command Op1 4 Note that we have replaced the full 2nq × 2nq one qubit operator by a se- ries of 2nq/2 sparse matrices. Thus we do not have to store the full 2nq ×2nq but simply provide a 2 × 2 matrix for repeated use. Each application of the 2 × 2 matrix involves distinct amplitude partners and therefore the set of 2×2 operations can occur simultaneously and hence in parallel. That paral- lel advantage was employed in our QCMPI fortran version, using the MPI[9] protocol for inter-processor communication. The 7.0 & 8.0 versions of Mathe- matica include only master-slave communication and therefore this advantage is not generally available. It is possible to use MPI with Mathematica[10], but only at considerable cost. Another promising idea is to use the “CLOJURAT- ICA”[11] package, but that entails an additional language. So the full MPI advantage will have to wait until MPI becomes available hopefully on future Mathematica versions. In the next section, this procedure is generalized to two- and three-qubit op- erators, using the same concepts. 3.2 Two-qubit operators The case of a two-qubit operator is a generalization of the steps discussed for a one-qubit operator. Nevertheless, it is worthwhile to present those details, as a guide to those who plan to use and perhaps extend QCWAVE. We now consider a general two-qubit operator that we assume acts on qubits i andi ,eachofwhichrangesoverthefull1,··· ,n possiblequbits.General s1 s2 q two-qubit operators can be constructed from tensor products of two Pauli operators; we denote the general two-qubit operator as V. Consider the action of such an operator on the multi-qubit state | Ψ(cid:105) : nq 4 Op1 yields result of a one-body operator Ω acting on qubit “is(cid:48)” in state ψ ; the 0 result is the final state ψ . Called as: ψ = Op1[Ω,is,ψ ]. f f 0 9 (cid:88) V| Ψ(cid:105) = C V| Q(cid:105) (26) nq Q Q 1 1 1 (cid:88) (cid:88) (cid:88) = ··· ··· C | q (cid:105)···(V| q q (cid:105)) ··· | q (cid:105). Q 1 s1 s2 nq q1=0 qs1,qs2=0 qnq=0 Here V is assumed to act only on the two q ,q qubits. The (V| q q (cid:105)) term s1 s2 s1 s2 can be expressed as 1 V| q q (cid:105) = (cid:88) | q(cid:48) q(cid:48) (cid:105)(cid:104)q(cid:48) q(cid:48) |V| q q (cid:105) (27) s1 s2 s1 s2 s1 s2 s1 s2 q(cid:48) ,q(cid:48) =0 s1 s2 using the closure property of the two-qubit product states. Thus Eq.(27) becomes 1 1 1 1 1 (cid:88) (cid:88) (cid:88) (cid:88) (cid:88) (cid:88) V| Ψ(cid:105) = C V| Q(cid:105) = ··· ··· ··· (28) nq Q Q q1=0 qs1=0 qs2=0 qnq=0qs(cid:48)1,qs(cid:48)2=0 C (cid:104)q(cid:48) q(cid:48) |V| q q (cid:105) | q (cid:105)··· | q(cid:48) q(cid:48) (cid:105)··· | q (cid:105). Q s1 s2 s1 s1 1 s1 s2 nq Now we can interchange the labels q ↔ q(cid:48) ,q ↔ q(cid:48) and use the label s1 s1 s2 s2 Q to obtain the algebraic result for the action of a two-qubit operator on a multi-qubit state, 2nq−1 (cid:88) ˜ (cid:88) ˜ V | Ψ(cid:105) = C | Q(cid:105) = C | n(cid:105), (29) nq Q n Q n=0 where 1 C˜ = C˜ = (cid:88) (cid:104)q q |Ω | q(cid:48) q(cid:48) (cid:105) C (30) Q n s1 s2 s s1 s2 Q(cid:48), q(cid:48) ,q(cid:48) =0 s1 s2 (cid:16) (cid:17) (cid:16) (cid:17) where Q = q ,q ,···q , and Q(cid:48) = q ,···q(cid:48) ···q(cid:48) ···q . That is Q and 1 2 nq 1 s1 s2 nq Q(cid:48) are equal except for the qubits acted upon by the two-body operator V. A better way to state the above result is to consider Eq.(30) for the following four choices n →(q ···q = 0···q = 0,···q ) 00 1 s1 s2 nq n →(q ···q = 0···q = 1,···q ) 01 1 s1 s2 nq n →(q ···q = 1···q = 0,···q ) 10 1 s1 s2 nq n →(q ···q = 1···q = 1,···q ), (31) 11 1 s1 s2 nq where the computational basis state label n denotes the four decimal qs1,qs2 numbers corresponding to Q = (q ,···q ···q ···q ). 1 s1 s2 nq 10

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.