Qsvt algorithm: computing the angles for projector-controlled phase gate

I have a question about the recent Quantum Singular Value Transformation (QSVT) tutorial. Let’s assume that I have a block encoding of matrix A. I would like to know how to calculate the angles needed for the projector-controlled phase gates when applying QSVT to block encodings of A^2, A^3, A^4, and so on. Additionally, I noticed that the definition of the projector-controlled phase gates in PennyLane is different, specifically in the sign of one phase angle, from what was defined in the tutorial Intro to QSVT | PennyLane Demos. I’m curious to know which definition is the correct one.

Hi @sassan_moradi,

Thanks for your question!

The angles for the Projector controlled phase gates depend on the convention used for the block encoding. Currently, we support two conventions, the first is the default convention used in the qml.BlockEncode class, and the so called “Wx” convention (Eq. 1 2021 Chuang et al.,). There are a few techniques for determining the phase angles for a given polynomial transformation in the literature (see for example 2018 Chuang et al.,). Alternatively, you could also just train your quantum circuit to learn the optimal phase angles. We will be releasing a tutorial on how to do this soon, so stay tuned!

Regarding the sign of the phase angles in the projector-controlled phase gates, there is no mistake. The gate itself depends on the subspace we are applying the phase shift onto. In the “Intro to QSVT” tutorial we block encode a 2x2 matrix, so we are applying phases on the top left 2x2 block. In the documentation, we are projecting into the top left 3x3 block. That definition would be used, for example, if we were working with a 3x3 block encoded matrix.

I hope this answers your question. Let us know if you have any other questions.
Cheers,

1 Like

Many thanks for your useful response.

2 Likes

Hi, my name is Ruben. I’m learning about quantum singular value transformations, and I think I’m starting to understand the physics behind the method. I have a question about “projector-controlled phase gates,” since “Intro to QSVT” (Pennylane) defines this operator as a diagonal element with elements e^{i \phi} and e^{- i \phi}. I would like to run this method on a quantum computer, but I need the quantum gates to construct the “projector-controlled phase gates.” Figure 3 of the article “Grand Unification of Quantum Algorithms” shows the quantum circuit to construct the projector-controlled phase, but it doesn’t implement the operator defined in “Intro to QSVT” (Pennylane) with e^{i \phi} and e^{- i \phi} on the diagonal. Do you know how I can implement this operator using the quantum gates defined in “Intro to QSVT”?

Hi @Ruben_Pena_Guzman!
Welcome to the forum.
Let me see if I can understand your question.
I am guessing that what you need is to implement the operator not using the native function from PennyLane qml.PCPhase but rather using controlled gates and a Z rotation gate. Is that right?
I am having a hard time comparing one formulation against each other and I think we shouldn’t try to do so because they seem to be using an auxiliary qubit and our formulation does not. What I mean is that we should not compare the matrix that could result from the method of the paper to the one we have in the Intro to QSVT.

However, just for the sake of doing it, I tried following the recipe from the paper and see what I would build for two qubits (one being the auxiliary one).

import pennylane as qml
import numpy as np

phi = np.pi / 2

basis_state = [0]
projector = qml.Projector(basis_state,wires=[1])
Cnot_projector = qml.X(0)@projector+qml.I(0)@(qml.I(1)-projector)
z_rotation = qml.RZ(2*phi,wires=0)

operator = Cnot_projector@z_rotation@Cnot_projector
print(np.round(qml.matrix(operator)))

We can keep the conversation going. Let me know.