Bernstein
Bernstein
3. The computing speed up is achieved by this algorithm as it takes only one call
to identify the function unlike its classical approach where it requires ‘n’ queries (for n
bit).
Comments on Algorithm.
5. The algorithm uses the key concepts of quantum parallelism and quantum
interference. First the n bit input state is initialised to |0> and is then prepared in equal
superposition state by applying Hadamard gate on all the n qubits. In this step all 2n
inputs are prepared and then evaluated by the unitary function Uf and hence quantum
parallelism is achieved.
6. Hadamard gates after the unitary function black box destroys all output values
except for ‘a’ which is the required solution.
Circuit Implementation
9. The input qubits is initialised to 0 and target output is initialised to 1 and created
in superposition using Hadamard gate. The circuit for the given value of a is as shown
below.
bernstein vazirani about:srcdoc
#creating an oracle unitary function that performs CX gate for each '1' in secret bit string
for digit, query in enumerate((reversed(a))):
if query=="1":
circ.cx(digit, len(a))
circ.barrier()
circ.draw('mpl')
1 of 3 11/10/23, 14:53