Implementing the Bernstein-Vazirani algorithm
The Bernstein-Vazirani algorithm refers to a quantum algorithm designed by Ethan Bernstein and Umesh Vazirani in 1992. In the same way as the Deutsch-Jozsa algorithm, its goal is to demonstrate that with some categories of problems, quantum algorithms provide an advantage over classical ones.
In this section, you will learn how to solve the Bernstein-Vazirani problem theoretically both in a classical and in a quantum way. You will then practically implement a quantum algorithm solving that problem while gaining intuition on some of Silq's core features.
Problem statement
Let's start with the definition of the problem solved by the Bernstein-Vazirani algorithm. The objective is to determine the value of a secret string encoded within a function, , passed as input. We know that f is a function taking as input an n-bit integer and returning its dot product (modulo 2) with some unknown string, . In other words, we have for...