Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Computer Physics Communications 144 (2002) 277–283

www.elsevier.com/locate/cpc

A simulator for ensemble quantum computing


Jeffrey A. George a , Michael E. Colvin b , V.V. Krishnan a,∗
a Biomolecular NMR, Biology and Biotechnology Research Program, L-448 Lawrence Livermore National Laboratory,
7000 East Avenue, Livermore, CA 94551, USA
b Computational Biology Group, Biology and Biotechnology Research Program, L-448 Lawrence Livermore National Laboratory,
7000 East Avenue, Livermore, CA 94551, USA
Received 15 May 2001; received in revised form 2 January 2002

Abstract
A quantum computer simulator based on the principles of ensemble quantum computing using nuclear magnetic resonance
(NMR) is presented. The first version of ensemble quantum computer simulator (enQC-lator) is based on density matrix
description of the NMR and models the implementation of quantum computation in a NMR spectrometer. The simulator is
designed to perform general purpose quantum computing and will be useful to evaluate quantum-computing codes prior to their
actual implementation and to design new ones. The performance of the simulator is demonstrated in several logical operations
and algorithms.  2002 Published by Elsevier Science B.V.
PACS: 03.67.L; 07.05.T; 87.64.H

Keywords: Quantum computer; NMR spectroscopy; Numerical integration; Simulation

1. Introduction trapped ions [8,9], cavity-QED [10], coupled quan-


tum dots [11], Josephson junctions [12,13], spin res-
Quantum computers offer the prospect of solving onance transistors [14,15], linear optics [16] and nu-
computational problems that are intractable to clas- clear magnetic resonance [17–19]. The nuclear mag-
sical computers such as efficient database searches netic resonance (NMR) is uniquely capable of con-
and cryptography [1–4]. A variety of algorithms have structing small quantum computers and several algo-
been developed recently, most notably Shor’s algo- rithms have been implemented successfully [20–25],
rithm for factorizing long numbers into prime fac- while the other experimental implementations are still
tors in polynomial time [5,6] and Grover’s quan- under development.
tum search algorithm for searching large databases The power of a quantum computer relies on the fun-
[4,7]. These algorithms were of only theoretical in- damental concept of the superposition in quantum me-
chanics and thus allowing an inherent large-scale par-
terest until several methods were proposed to build
allelization of computation. The basic idea of a quan-
physical quantum computers. These methods include
tum computer is that bits representing numbers could
be embodied in a two-state quantum system, such as
* Corresponding author. spin degrees of freedom of a spin-1/2 particle and the
E-mail address: krish@llnl.gov (V.V. Krishnan). computation is performed on these qubits (quantum
0010-4655/02/$ – see front matter  2002 Published by Elsevier Science B.V.
PII: S 0 0 1 0 - 4 6 5 5 ( 0 2 ) 0 0 2 6 6 - 7
278 J.A. George et al. / Computer Physics Communications 144 (2002) 277–283

mechanical bits) by appropriate logical gates. NMR |Ψ  is a vector in the 2N -dimensional Hilbert space
quantum computers differ from other implementations and |ψκ  are the eigenstates that can be expressed as
in that the quantum computer is not a single coherent a direct product of the single spin eigenfunctions |αι 
state, but a statistical ensemble of them. Thus quantum and |βι  of spin Ii as
computing based on NMR is considered as ensemble
quantum computing and must be described using den- |ψk  = |α1 |β2 |β3  . . . |αN−1 |βN  = |αββ . . . αβ
sity matrices rather than the conventional approaches. ≡ |011 . . .01. (2)
In NMR quantum computing, an organic molecule dis-
solved in an appropriate solvent with a specified num- Thus, each eigenstate corresponds to a string of
ber of spin 1/2 atoms (such as 1 H or 13 C) will form N classical bits. Any quantum mechanical manipula-
the qubits, while the algorithms correspond to set of tion allows the operation on N classical bits simul-
instructions containing radio frequency (rf) pulses and taneously represented by the set of eigenstates |Ψ .
delays (known as pulse sequence) to manipulate the This is the basis for the inherent parallel processing
spins and the final spectrum reflects the outcome of on quantum computers. In the case of ensemble quan-
the algorithm. tum computing by nuclear magnetic resonance, each
In this manuscript, we present a program to simu- spin is represented by an atom nucleus with spin 1/2
late an ensemble quantum computer as described by in a molecule. The system is concisely represented by
NMR spectroscopy. The ensemble quantum computer the spin Hamiltonian, Hspins given by [27]
simulator (enQC-lator) has been designed as a useful  
tool for developing new NMR based quantum algo- Hspins = ωoj Ij z + 2π Jmn Im · In , (3)
rithms and for simplifying the experimental setup so j m<n
that the actual time spent on the spectrometer is mini-
where the first term represents the Larmor precession
mized. The enQC-lator is based on fundamental prin-
of the spin Ij at frequency ωoj and the second term
ciples of high resolution NMR spectroscopy by de-
determines the scalar coupling between the spins
scribing the system using density matrix formalism.
Im and In with a coupling constant Jmn . In the
Though the overall architecture of the simulator allows
absence of an external radio frequency (rf) field, the
straightforward scalability to at least eight qubits, we
evolution of the spin system is determined by the
have confined our results to only up to three qubits in
above Hamiltonian. The presence of any rf field can
this first version of the program. It is written in C++
be represented by a general Hamiltonian as
with advanced numerical integration routines that can
  
allow the simulation of practically any quantum algo- Hrf = ω1j Ij z cos(φj ) + Ijy sin(φj ) , (4)
rithm that is currently available. The performance of j
the simulator is demonstrated for several two and three
qubit quantum computers. where ω1j is the amplitude of the rf field in frequency
units (ω1 = γj B1j ) applied to spin ‘j ’ and φj is the
corresponding phase.
2. Theory and methods NMR spectroscopy dictates the need to have an
ensemble of identical spin systems with statistically
The simulator is based on the how a set of spin populated states in order to observe the spectrum and
1/2 particles evolve in the presence of a given Hamil- the behavior of such a system is represented by a spin
tonian, typically in a NMR experiment. A brief presen- density matrix, defined as [26,27,29]
tation of the method is given below and complete de- 
tails are available in comprehensive treatises [26,27]. σ= Bl |Ψl  Ψl |. (5)
The state of a system of N spins (I = 1/2), each rep- l
resenting a qubit is represented in compete by the state The ‘master’ equation for the spin density ma-
vector |Ψ  as [28] trix σ (t) for a N scalar coupled spins in the ab-

|Ψ  = |ak |ψk . (1) sence of relaxation process is governed by Liouville–
k
von Neumann equation [26,27]:
J.A. George et al. / Computer Physics Communications 144 (2002) 277–283 279

   
∂σ (t)/∂t = −i H, σ (t) = −i H σ (t) − σ (t)H , current implementation, this conversion needs to be
(6) done manually, but efforts are underway to incorporate
a translator (shown by dashed box in Fig. 1) that would
where H is the total Hamiltonian (Hspins + Hrf ). The convert these automatically. The spin and system para-
quantum computing code at any given moment during meters (Eqs. (3) and (4)) are used in the Hamiltonian
the NMR experiment is governed by the above equa- generator module to construct the appropriate Hamil-
tion. The exact details of the evolution of quantum al- tonians for the NMRQC code. The enQC-lator also
gorithm are then dictated by the complete Hamiltonian consists of a numerical integration routine that eval-
H . Re-writing the above equation in a matrix form uates the state of the spin systems at each time step as
with a suitable basis set, determined by the master equation (Eqs. (6) and (7)) in
   accordance with the user specified QC algorithm to be
∂σij (t)/∂t = −i Hik σkj − σik Hkj . (7) simulated and system parameters. The numerical in-
k k tegration was performed using the Bulirsch–Stoer al-
For N spins, the above equation represents a set of gorithm [30]. At the end of the execution of the QC
2N coupled, linear differential equations that can be code, the state of the either the complete density ma-
solved using numerical integration. trix or the observable part of it can be visualized either
The principal flowchart of the enQC-lator is shown as a NMR spectrum or as a numerical matrix.
in Fig. 1. Each module is developed in such a way that Initial phases of the EnQC-lator are primarily
additional improvement and modifications can be eas- written in C++ (compiled using standard gcc) on a SGI
ily incorporated. Once the quantum algorithm and the O2 workstation, employing a MIPS R10000 processor,
related logical operations to be simulated are identi- within the IRIX environment. The final version was
fied, the corresponding NMR QC code, expressed in then ported to a Linux workstation running Caldera
terms of the pulse sequence, can be designed. In the OpenLinux 2.3 that employs a single P-II 400 MHz
processor with 128 M of RAM. Perl 5 with CGI
packages is also used to create a web-based interface
for the simulation as well as to pipe the required output
at the end of the simulation.

3. Results

3.1. Two-qubit simulations

Quantum computations are decomposed into a se-


quence of logic operations or gates that are ex-
pressed as classical Boolean expressions, such as
NOT, XOR, AND/NAND and OR/NOR. These gates
have been successfully implemented as NMR pulse
sequences and simulated using the current program
(data not shown). In order to demonstrate the perfor-
mance of the simulator, we show three different test
cases; (1) the SWAP operation, (2) the creation of
an Einstein–Podolsky–Rosen (EPR) state, and (3) the
performance of the Deutsch–Josza algorithm. The re-
sults are summarized in rows b, c and d of Fig. 2,
respectively. The quantum computing circuits [31,32]
Fig. 1. (a) Flow chart description of the ensemble quantum computer for the qubits 1 and 2 (Q1 and Q2 , respectively)
simulator (enQC-lator). are shown in the first column and the corresponding
280 J.A. George et al. / Computer Physics Communications 144 (2002) 277–283

Fig. 2. Results from the ensemble quantum-computing simulator for two-qubits. The columns from left to right correspond to the quantum logic
operation, the quantum-computing code as represented by nuclear magnetic resonance pulse sequence, the results of the operation in spectrum
and the final density matrix (absolute values), respectively. The rows are (a) the Hadamard operation (H ), (b) the SWAP operation (transfer of
information from one qubit to another), (c) the creation of an EPR (Einstein–Podolsky–Rosen) state, (d) the Deutsch–Josza algorithm to evaluate
the balanced (f10 (x)) binary function. Line-widths of 1.1 Hz in the spectra were used for the sake of presentation. The system parameters for
the two qubits are protons (hydrogen atoms) resonating at νI 1 = 100 Hz and νI 2 = 300 Hz with a scalar coupling constant of JI 1I 2 = 12 Hz
between them using a spectrometer frequency of 600 MHz.

pulse sequences are shown in the next. The first row incorporated a unidirectional SWAP (Q1 → Q2 ) by
of Fig. 2(a) shows the reference data in which the applying a selective pulse to only the first qubit.
Hadamard (H ) operation is performed. The matrix At the end of the code, a pulse is applied only
presentation of the initial state corresponds to a nor- to the transferred qubit. Parts of the logic diagram
mal one-dimensional NMR spectrum at thermal equi- and the pulse sequence that are needed to make the
librium. The off-diagonal elements that are complex in complete symmetric SWAP (Q1 ↔ Q2 ) are shown
nature are presented in absolute value for the sake of in dotted lines in Fig. 2(b). The result shows the
simplicity. resonance lines only at the second qubit position,
The SWAP operation (Fig. 2(b)) is used in quantum while to start with the information was only on
computing to transfer information from one qubit to the first qubit. These results are consistent with the
another [22]. If |s and |t are the states of the spins corresponding matrix representation (non-zero matrix
I1 and I2 , then the SWAP operation is defined by elements only at transitions corresponding to the
|s, t → |t, s. It is a symmetric operator, such that second qubit) as well with that of the experimental
the information from two qubits can be simultaneously implementation [22].
transferred between them. In the case of a two-qubit The simulation of an EPR (Einstein–Podolsky–
system since the initial and final states will be identical Rosen) state is demonstrated in Fig. 2(c). This involves
after such an operation, and hence it will produce two quantum logic gates, a Hadamard transform on
identical NMR spectra. In order to demonstrate the the first qubit (shown as H in the logic circuit) fol-
performance of SWAP operation (Fig. 2(b)), we have lowed by a two-qubit controlled-NOT (CNOT) opera-
J.A. George et al. / Computer Physics Communications 144 (2002) 277–283 281

tion. The Hadamard transform can be represented by tally demonstrated by Jones and Mosca [34]. The same
(π/2)◦ pulses on both the qubits that are at thermal procedure is adopted here. The spins were prepared in
equilibrium. The final state of the system corresponds an effective pure-state and the established method to
to transitions between states that can not be measured perform the DJ algorithm is implemented soon after.
by conventional one-dimensional NMR spectrum as it Fig. 2(d) shows the results of DJ’s algorithm for one of
can detect only quantum states that differ by ±1. How- the two possible balanced functions. The other evalu-
ever, the matrix representation conveniently shows the ations also work equally well (data not shown).
creation of the EPR state. This example also demon-
strates the versatility of the enQC-lator’s options to 3.2. Three-qubit simulations
generate output results in different formats.
The Deutsch–Josza (DJ) algorithm is the most com- To compare different physical realizations of quan-
mon quantum algorithm that is used to demonstrate tum algorithms, recently Knill et al. [35] have estab-
the performance of any new experimental quantum lished a benchmark experiment based on ensemble
computing method [33]. This algorithm addresses the quantum computing. This benchmark experiment is
problem of deciding whether a binary function is con- designed to characterize the reliability and coherency
stant or balanced [2]. The binary function f (x) (x ∈ of the quantum computer. It is an appropriate choice
[0, 1] and f (x) ∈ [0, 1]), is defined as constant if f (x) for demonstrating the performance of the enQC-lator.
is independent of x and balanced if f (x) changes from This method is based on the properties of ‘cat’ states,
0 to 1 (or vice versa) on changing x. The goal of named by analogy with Schrödinger’s Cat and hence
the algorithm is to determine the nature of the func- referred to as the ‘cat-state benchmark’. For a three
tion using a quantum computer. A distinguishing fea- qubit quantum computer (spins I1 , I2 and I3 , respec-
ture of this algorithm is that it requires two func- tively), the cat-state benchmark has an encoding and
tion evaluators on a classical computer, while it is decoding stages. Fig. 3 illustrates the flow of the
completed with only one query in a quantum algo- experiment. Information from the first qubit (I1 ) is
rithm. Deutsch–Josza algorithm has been experimen- subjected to a set of single spin rotations (selective

Fig. 3. Demonstration of the encoding and decoding parts of the cat state benchmark evaluation of a three-qubit quantum computer using
the enQC-lator. Arrow marks represent the direction of the flow of operations. (a) Reference spectrum obtained after a selective 90◦ pulse
to Q1 . The coupling network between the qubits schematically represented for (b) JI 1I 2 = 12.0 Hz, JI 2I 3 = 10.0 Hz and JI 1I 3 = 0.0 Hz,
(c) JI 1I 2 = 12.0 Hz, JI 2I 3 = 10.0 Hz and JI 1I 3 = 8.0 Hz, and (d) JI 1I 2 = 11.5 Hz, JI 2I 3 = 12.0 Hz and JI 1I 3 = 12.5 Hz. The other system
parameters for this simulation are νI 1 = 100 Hz, νI 2 = 250 Hz, νI 3 = 425 Hz and a spectrometer operating frequency of 600 MHz.
282 J.A. George et al. / Computer Physics Communications 144 (2002) 277–283

rf pulses) and two qubit operations (shown as ver- ferent from enQC-lator. This simulator is a first ver-
tical bars in Fig. 3) that utilize the J coupling be- sion of a ensemble QC-simulator that is indepen-
tween spins I1 and I2 . Similar operations are then re- dent of the experimental system (molecules) and the
peated between the second and third qubits (spins I2 mode of implementation (pulse sequences), so that
and I3 ). A combination of three-spin coherence (mul- any quantum algorithm derived in terms of logic di-
tiple quantum coherence involving three spins) is cre- agram can be simulated. This approach could also
ated at the end of the encoding stage. This super- be used to generate experimental pulse sequences for
position of quantum information from all the three a given quantum logic diagram either for simulation
qubits is stored in the off-diagonal elements of the or for actual implementation in a NMR spectrometer.
density matrix that are not observable by a direct one- The motivation for the development of this simula-
dimensional NMR spectrum. Before applying the de- tor is to allow researchers to design, test and improve
coding stage of the computation, it is required to retain quantum logical operations or algorithms and compare
only the above mentioned coherence. In the decoding the theoretical derived protocols with experimental re-
stage of the cat-state benchmark, an exact reversal of sults. As this method is based on numerical integra-
the encoding operations can be performed and the in- tion routines, the incorporation of any shaped and se-
formation is returned to the first qubit (I1 ). A com- lective pulses is straightforward and does not increase
parison of the final spectrum at this end with the ref- in the computational cost. Though the current simula-
erence spectrum is then used to determine the fidelity tor has been optimized for applications that are spe-
of the quantum computing system. The efficiency of cific to NMR quantum computing, it is generally use-
the benchmark depends on two factors: how selec- ful for other applications of interest in quantum com-
tively the information can be transferred between the puting.
qubits without leakage to the other qubits and the total
available coherence length. The cat-state benchmark
was simulated for three different coupling topologies Acknowledgements
as shown schematically in Fig. 3. The simulation of
cat-state benchmark in a homonuclear three-qubit sys- Thanks to Dr. M. Cosman for critical reading of the
tem with nearly equal coupling between the protons manuscript. JAG was a summer student and supported
(Fig. 3(d)) shows that this system is not efficient for by funding from the DOE, Defense Programs, and Of-
quantum computing, mainly due to the non-selective fice of University Partnerships. This work was per-
nature of information transfer between the qubits. In formed under the auspices of the U.S. Department of
an experimental quantum computing setup, estimating Energy by the University of California, Lawrence Liv-
the fidelity is a worthwhile exercise, while in the case ermore National Laboratory under Contract No. W-
of the simulation this benchmark demonstrates only 7405-Eng-48 and Laboratory Wide Director’s Initia-
the quality of the numerical errors. The enQC-lator is tive grant 99-LW-068 to MC and VVK.
numerically stable and the numerical errors are in the
order of 10−6 .
References
4. Conclusion
[1] R.P. Feynman, Int. J. Theor. Phys. 21 (1982) 467–488.
[2] D. Deutsch, Proc. Roy. Soc. London Ser. A 400 (1985) 97–117.
We have presented a new program, based on NMR [3] C.H. Bennett, G. Brassard, A.K. Ekert, Sci. Amer. 267 (1992)
methods and quantum mechanical principles to sim- 50–57.
ulate an ensemble quantum computer. Recently [4] L.K. Grover, Phys. Rev. Lett. 79 (1997) 325–328.
De Raedt and co-workers [36] have presented a quan- [5] P.W. Shor, in: S. Goldwasser (Ed.), Proceedings of the 35th
Annual Symposium on Foundations of Computer Science,
tum computer emulator and demonstrated the per- IEEE Computer Society Press, Los Alamitos, CA, 1994.
formance of two qubit systems, while Steeb and [6] P.W. Shor, SIAM J. Comput. 26 (1997) 1484–1509.
Hardy [37] have proposed a symbolic C++ language. [7] L.K. Grover, Science 281 (1998) 792–794.
The emphasis and approach of these methods are dif- [8] J.I. Cirac, P. Zoller, Phys. Rev. Lett. 74 (1995) 4091–4094.
J.A. George et al. / Computer Physics Communications 144 (2002) 277–283 283

[9] C. Monroe, D.M. Meekhof, B.E. King, W.M. Itano, D.J. [24] J.A. Jones, Fortschr. Phys. 48 (2000) 909–924.
Wineland, Phys. Rev. Lett. 75 (1995) 4714–4717. [25] T.S. Mahesh, K. Dorai, Arvind, A. Kumar, J. Magn. Re-
[10] Q.A. Turchette, C.J. Hood, W. Lange, H. Mabuchi, H.J. Kim- son. 148 (2001) 95–103.
ble, Phys. Rev. Lett. 75 (1995) 4710–4713. [26] A. Abragam, The Principles of Nuclear Magnetism, Clarendon
[11] D. Loss, D.P. DiVincenzo, Phys. Rev. A 57 (1998) 120–126. Press, Oxford, 1962.
[12] D.V. Averin, Chaos Soliton Fractals 10 (1999) 1679–1688. [27] R.R. Ernst, G. Bodenhausen, A. Wokaun, Principles of Nuclear
[13] D.V. Averin, Fortschr. Phys. 48 (2000) 1055–1074. Magnetic Resonance in One and Two Dimensions, Clarendon
[14] B.E. Kane, Nature 393 (1998) 133–137. Press, Oxford, 1990.
[15] R. Vrijen, E. Yablonovitch, K. Wang, H.W. Jiang, A. Balandin, [28] C. Cohen-Tannoudji, B. Diu, F. Laloë, Quantum Mechanics,
V. Roychowdhury, T. Mor, D. DiVincenzo, Phys. Rev. A 62 Wiley, New York, 1977.
(2000) 2306. [29] C.P. Slichter, Principles of Magnetic Resonance, Springer-
[16] E. Knill, R. Laflamme, G.J. Milburn, Nature 409 (2001) 46–52. Verlag, Berlin, New York, 1990.
[17] N.A. Gershenfeld, I.L. Chuang, Science 275 (1997) 350–356. [30] W.H. Press, Numerical Recipes in C: The Art of Scientific
[18] D.G. Cory, A.F. Fahmy, T.F. Havel, Proc. Nat. Acad. Sci. Computing, Cambridge University Press, Cambridge, 1997.
USA 94 (1997) 1634–1639. [31] A. Barenco, C.H. Bennett, R. Cleve, D.P. Divincenzo, N. Mar-
[19] J.A. Jones, M. Mosca, R.H. Hansen, Nature 393 (1998) 344– golus, P. Shor, T. Sleator, J.A. Smolin, H. Weinfurter, Phys.
346. Rev. A 52 (1995) 3457–3467.
[20] D.G. Cory, M.D. Price, T.F. Havel, Physica D 120 (1998) 82– [32] X.L. Zhou, D.W. Leung, I.L. Chuang, Phys. Rev. A 6205
101. (2000) 2316, U177–U187.
[21] J.A. Jones, R.H. Hansen, M. Mosca, J. Magn. Reson. 135 [33] D. Collins, K.W. Kim, W.C. Holton, Phys. Rev. A 58 (1998)
(1998) 353–360. R1633–R1636.
[22] Z.L. Madi, R. Bruschweiler, R.R. Ernst, J. Chem. Phys. 109 [34] J.A. Jones, M. Mosca, J. Chem. Phys. 109 (1998) 1648–1653.
(1998) 10 603–10 611. [35] E. Knill, R. Laflamme, R. Martinez, C.H. Tseng, Nature 404
[23] D.G. Cory, R. Laflamme, E. Knill, L. Viola, T.F. Havel, (2000) 368–370.
N. Boulant, G. Boutis, E. Fortunato, S. Lloyd, R. Martinez, [36] H. De Raedt, A.H. Hams, K. Michielsen, K. De Raedt,
C. Negrevergne, M. Pravia, Y. Sharf, G. Teklemariam, Y.S. Comput. Phys. Commun. 132 (2000) 1–20.
Weinstein, W.H. Zurek, Fortschr. Phys. 48 (2000) 875–907. [37] W.H. Steeb, Y. Hardy, Int. J. Mod. Phys. C 11 (2000) 323–334.

You might also like