Quantum Computing, Quantum Physics, Programming, Physics, Science.
0], [0, -1]]) elif init == 'Y': out = np.array([[0, -1j], [1j, 0]]) else: out = np.eye(2) for p in string: if p == 'X': out = np.kron(out, np.array([[0, 1], [1, 0]])) elif p == 'Z': out = np.kron(out, np.array([[1, 0], [0, -1]])) elif p == 'Y': out = np.kron(out, np.array([[0, -1j], [1j, 0]]))