Quantum Computing, Quantum Computer, Qiskit, Quantum Physics, Python.
measurement in the Z basis, we must create our own using Hadamard gate: # Create the X-measurement function: def x_measurement(qc, qubit, cbit): """Measure 'qubit' in the X-basis, and store the result in 'cbit'""" qc.h(qubit) qc.measure(qubit, cbit) return qc initial_state = [1/sqrt(2), -1/sqrt(2)]