Skip to content
This repository was archived by the owner on Oct 7, 2019. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions referenceqvm/unitary_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ def permutation_arbitrary(args, num_qubits):
if not (0 <= ind < num_qubits):
raise ValueError("Permutation SWAP index not valid")

seen = set()
for x in inds:
if x in seen:
raise ValueError("Duplicate qubit %d found" % x)

# Begin construction of permutation
perm = sps.eye(2 ** num_qubits).astype(np.complex128)

Expand Down