python-quaec icon indicating copy to clipboard operation
python-quaec copied to clipboard

Invalid indices silently accepted by Clifford factory functions.

Open cgranade opened this issue 11 years ago • 0 comments

As pointed out by @glassnotes, functions such as q.hadamard currently do not behave well at all when given indices outside the valid range given by the number of qubits. For instance,

>>> print q.hadamard(1, 1)
XI |->  +XI
IX |->  +IZ
ZI |->  +ZI
IZ |->  +IX
>>> print q.phase(1, 3)
X[3] |->  +Y[3]

These should instead raise IndexError exceptions, since there's no sensible meaning to assign to "apply the phase gate to the fourth of one qubits."

cgranade avatar Oct 22 '14 19:10 cgranade