Skip to content

Invalid indices silently accepted by Clifford factory functions. #4

Description

@cgranade

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."

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions