Skip to content

Commit

Permalink
initial implementation of quantum state as list of amplitudes
Browse files Browse the repository at this point in the history
  • Loading branch information
jtauber committed Jan 18, 2013
1 parent 28ef15f commit 5346779
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions quantum.py
@@ -0,0 +1,10 @@
class Psi:
def __init__(self, n_qubits):
"""
set up a quantum system with the given number of qubits
initialized to the "zero" qubit.
"""
self.n_qubits = n_qubits
# in this classical simulation, we use 2^n_qubits complex numbers
self.amplitudes = [0] * (1 << n_qubits)
self.amplitudes[0] = 1

0 comments on commit 5346779

Please sign in to comment.