Quantum Simulators
DoRon Motter
August 2, 2001
Introduction
• Currently a wide variety of quantum simulators are available
• Good to know to avoid duplication of effort
• Different simulators have different target audiences
• Different simulators have different strengths/weaknesses
Simulator Space
• Simulators of a single algorithm– ex. Shor’s Algorithm
• Simulators for illustration– Often simulate a single algorithm– Give some sort of display with heavily
annotated source
• Quantum API’s / Programming Languages• Java Applets
Single Algorithm
• Often provide the best performance (for this single algorithm)
• Performance results vary– Different ‘implementations’ of the algorithm– Different OS/language requirements– Different results(!)
• Often undeveloped API’s
Illustrative Simulators
• Often Mathematica worksheets
• Provide heavily annotated source
• Often integrate source/annotations and display
• Useful when attempting to understand (or explain)
Quantum API’s
• Provide ‘high-level’ quantum operations
• Often provide completely generic QC simulation
• The widest approach, with several good options
Simulator Traits
• Interface – C/C++– GUI
• Speed
• Source Availability
• Universality
Single Algorithm: OpenQubit
• http://www.ennui.net/~quantum/
• API but only complete enough to do Shor’s
• Open Source (GPL)
• Useful because it’s GPL and hopes to become an API
Quantum API: QCE
• http://rugth30.phys.rug.nl/compphys0/qce.htm
• Quantum Computer Emulator• Provides support (GUI) for testing/sim of quantum
algorithms on various hardware – Support for interactions as a result of implementation
• Interesting because it takes into account physical implementation
• Built in visualization
Quantum API: QCE
Quantum API: QDD
• http://home.plutonium.net/~dagreve/qdd.html• (And SHORNUF…)• Uses BDD’s to represent quantum state
– Gains an efficiency advantage
– Loses the ability to perform analog computations
• Open Source• Probably the most efficient ‘general purpose’
simulator
Quantum API: QDDX.Set(0); // place the register in a superposition of states.X.Mix();F.Set(0);expn(A,Number,X,F, 1); // F = a^X mod n // Perform a classical sampling of F. This collapses the entire
quantum // state so that it is consistant with the value measured in F. Fv = F.Sample(); // Measure the period of X. Unfortunately, a bit of a quantum cheat.Pv = X.Period();f1 = gcd((powmod(A,Pv/2,Number) + 1) % Number , Number) ;f2 = gcd((powmod(A,Pv/2,Number) + Number - 1) % Number ,
Number) ;Xv = X.Sample(); Cv = powmod(A,Xv,Number); assert(Cv == Fv, "Mismatch"); f1 = gcd(Number,f1); f2 = gcd(Number,f2); Factor = (f1 > f2 ? f1 : f2); found = (Factor > 1) && (Factor < Number);
Quantum API: QCL
• http://tph.tuwien.ac.at/~oemer/qcl.html
• Quantum Computation Language
• A high-level, architecture independent programming language
• Separates algorithm from implementation
• Provides reference implementation
• Interprets commands in its own ‘shell’
Quantum API: QCL
operator dft(qureg q) { // main operatorconst n=#q; // set n to length of inputint i; int j; // declare loop countersfor i=0 to n-1 {
for j=0 to i-1 { // apply conditional phase gates
CPhase(2*pi/2^(i-j+1),q[n-i-1] & q[n-j-1]);}Mix(q[n-i-1]); // qubit rotation
}flip(q); // swap bit order of the output
}
Quantum API: QCS
• http://www.senko-corp.co.jp/qcs/
• Universal Quantum Computer Simulator
• Closed Source, Commercial
• GUI interface to building circuits
Conclusion
• Different approaches to Universality– GUI circuit building from gates– C++ algorithm writing
• Tradeoffs must be considered– Universality vs. Speed