I am trying to do the superposition of a subset of integers using qiskit. For instance: $|13\rangle + |14\rangle + ... |N\rangle$ (uniform superposition) without the part $|0\rangle + |1\rangle + ... + |12\rangle$. Is it possible? How can I proceed?
I would do something like this :
n = 5 #number of qubits N = 2**n #32 sup = [0.]*N start = 12 #your 13, considering list index starts at 0 norm = N-start #used for normalisation of the vector we'll pass for i in range(start, N): #creation of the list where the 0s are at indices on the first part you don't want sup[i]=np.sqrt(1/norm) qc = QuantumCircuit(n) qc.initialize(sup, range(n)) qc.draw()
Tell me if something isn't clear :)