Skip to main content

View on GitHub

Open this notebook in GitHub to run it yourself
This demo shows how to use the QSVT framework for search problems; specifically, implementing fixed-point amplitude amplification (FPAA). With FPAA, we do not know in advance the concentration of solutions for the search problem, but we want to sample a solution with high probability. In contrast, for the original Grover search algorithm, too many iterations might ‘overshoot’ the mark. The demo is based on the paper Grand unification of quantum algorithms. Given ∣s⟩|s\rangle the initial state and ∣t⟩|t\rangle the ‘good’ states, we get an effective block encoding of a one-dimensional matrix A=∣t⟩⟨s∣A=|t\rangle\langle s|. Given that a=⟨s∣t⟩>0a = \langle s|t\rangle\gt0, we want to amplify aa. The signal operator UU here is II (and also U†U^\dagger). Now we implement two projector-rotations: one in the '∣s⟩|s\rangle' space and one in the '∣t⟩|t\rangle' space; each one around the given state, giving phase to the specific state.

Defining the QSVT Circuit for the Problem

image.png We start with the general QSVT framework definition. It accepts a unitary that block-encodes a matrix together with projector-controlled phase functions, which rotate the state around each of the subspaces where the matrix is encoded. The qsvt function accepts 3 different functions:
  1. Block Encoding function: the one for which the singular values are transformed. In this case, the block encoding is trivial, and is just the Identity.
  2. Domain projector-controlled-CNot: a function that identifies subspace in the domain of the block encoding (i.e the columns of the block encoding). In our case it is an identifier for the initial state ∣s⟩|s\rangle.
  3. Image projector-controlled-CNot: a function that identifies subspace in the image of the block encoding (i.e the rows of the block encoding). In our case it is an identifier for the target state ∣t⟩|t\rangle.
So we get a 1x1 block encoded matrix, which will be transformed using a polynomial that approximates the sign function, so that all inputs will be amplified to approximately
  1. We need an even degree polynomial since we need to “finish” our sequence in the image space of our unitary.

Domain State Projector: Identify the ∣s⟩|s\rangle State

Image States Projector: Identify the ∣t⟩|t\rangle State

Defining the Arithmetic Oracle

We implement the following equation: (a + b) == 3 and (c - a) == 2 with a, b, c in sizes 2, 1, 3:

Wrapping Everything for the FPAA Case

In the FPAA case, the provided unitary is just the Identity matrix! In addition, we provide defined projector functions:

Getting the Phase Sequence for the Sign Function

Here for demonstration purpose we assume that the initial state has at least MIN_OVERLAP=0.1 with the target state (in probability). So we approximate the constant function (a scale of 0.95 is used for stability), and we only care about the interval [MIN_OVERLAP, 1].
output
Output:

Creating the Full QSVT Model

Synthesizing and Executing on a Simulator

We use the Classiq synthesis engine to translate the model to a quantum circuit, and execute on the Classiq simulator:
Output:
Execute the circuit:
Output:
Output:
What do we expect? We need to substitute the amplitude of ∣s⟩⟨t∣|s\rangle\langle t| in P(x)P(x):
Output:
Indeed, we received the expected result according to the polynomial we created with the QSVT sequence:

References

[1]: Martyn JM, Rossi ZM, Tan AK, Chuang IL. Grand unification of quantum algorithms. PRX Quantum. 2021 Dec 3;2(4):040203.