View on GitHub
Open this notebook in GitHub to run it yourself
Defining the QSVT Circuit for the Problem

qsvt function accepts 3 different functions:
- 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.
- 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 .
- 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 .
- 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 state
Image States Projector: identify the 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 leastMIN_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:
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:
Output:
Output: