QCSim is a quantum computation simulator written in C++. It does a discrete-time simulation of 2-level quantum entities (qubits). QCSim reads a file written in a subset of QHDL which includes declaration of qubits, the initial state of the quantum system, and a series of quantum gates and commands. This language comes from "Final Report-A Design Language for Quantum Computing" ORA TR-03-0001, Odyssey Research Associates, Inc., Ithaca, New York. Currently there is no mechanism to add qubits after the initial declaration.
Source code is freely available, and includes simulations of BB84, teleportation, a Hamming [3,1] (3 repetition) error correcting code, Steane 7-qubit ECC, Grover's algorithm, etc.
Input is from a file specified on the command line. All operations are on the current state, stored as complex numbers in a density matrix. Output is printing the current state, i.e., density matrix (or the interesting parts left after tracing over ancilla, etc.).
On our machine, QCSim can only allocate memory for 13 qubits because storage increases exponentially. In an n-qubit system, the density matrix is 2n by 2n.
The input declares two qubits, a and b, and initializes them to a state chosen to make it easier to follow how the values "dance". We print the initial state, do the swap, and print the final state.
|
variable a, b:qubit; # this normalizes to convenient probabilities =|00>-2i|01>-3|10>+6|11>; print_state(); # swap cnot(b, a); cnot(a, b); cnot(b, a); print_state(); |
|
|
Welcome to QCSim 1.5
current state: a, b
0.02 0.04i -0.06 0.12
-0.04i 0.08 0.12i -0.24i
-0.06 -0.12i 0.18 -0.36
0.12 0.24i -0.36 0.72
current state: a, b
0.02 -0.06 0.04i 0.12
-0.06 0.18 -0.12i -0.36
-0.04i 0.12i 0.08 -0.24i
0.12 -0.36 0.24i 0.72
|
Notice that the probabilities of the |01> and |10> states, 0.08 and 0.18, swapped. (The output is slightly edited.) The screen shots page has other inputs and outputs.
The Tests directory in the distribution has four kinds of tests for QCSim:
Basic operations and gates include: Hadamard, Pauli X (bit flip), Pauli Z (phase flip), Pauli Y, various controlled not gates, noisy Hadamard, amplitude damping and depolarization "gates", etc. Code for a new gate can be added easily.
Special functions and commands include:
Some gates are:
Modeling quantum information systems for simulation.
QCSim was initially written by Matthew Cass at NIST June-August 2002. QHDL parser and additional code by Andrew Lane at NIST June-August 2003. Additional operations and code by Paul E. Black.
Send comments to: webmaster-sdct
Privacy Policy
Created Jul 11 2003 by Andrew Lane
This page's URL is: http://hissa.nist.gov/~black/Quantum/qcsim.html