Problem Statement: Task 1
Design a quantum circuit that considers as input the following vector of integers numbers:
[1,5,7,10] returns a quantum state which is a superposition of indices of the target solution, obtaining in the output the indices of the inputs where two adjacent bits will always have different values. In this case the output should be: 1/\sqrt{2} (|01> + |11>), as the correct indices are 1 and 3.
The file Task 1 Final-General_Circuit.ipynb solves the Problem statement 1
The file Bonus_task_1.ipynb contains solution for the bonus task.
Solution for the task
Bonus: Design a general circuit that accepts vectors with random values of size 2n with m bits in length for each element and finds the state indicated above from an oracle.
Generalized circuit
Generalized circuit with relevent number of qubits required
Extreme limits of the approach
Since QASM allows to simulate at max 32 qubits, this restricts the value of 𝑛 < 7 (𝑛 is the number of addresses qubits) and 𝑚 < 8 (number of bits in the binary expansion of the number). The remaining qubits are either used for the Oracle or ancillas required for the multi control troffoli gates. At it's extreme i.e. 𝑛 = 6 and 𝑚 = 7 the circuit becomes so big that qiskit can not draw it. ValueError: Image size of 1604x250997 pixels is too large. It must be less than 2^16 in each direction.
Result
Above resuls are in excellent agreement with the theoretical predictions. In conclusion at it's best (Using all the resources from QASM) this approch efficiently finds solutions in haystack of 2^(6)= 64 numbers ranging between 0 to 127. It was a great learning opportunity. Looking forward for future challenges. :)