Normalization in qp.BlockEncode

Hi,

I am a newbie for Pennylane as well as quantum computing itself. I am trying to understand the QSVT and apply my dense and asymmetric matrices. Since the norm of such a matrix (say A) is usually grater than one, qp.BlockEncode in concern normalizes it automatically and saves the normalization factor as ‘hyperparameters[“norm”]’, according to the document. However, the actual program looks to normalize A not by "hyperparameters[“norm”]’ but by the code
A = qp.math.array(A) / qp.math.maximum(normalization, qp.math.ones_like(normalization)).

So, instead of the number
op.hyperparameters[“norm”],
I think we should use the number
np.max(op.hyperparameters[“norm”], 1.0)
as the nomalization factor, where op is the instance of qp.BlockEncode.

Am I correct?

Hi @ttaka ,

Welcome to the Forum!

You are correct in the fact that hyperparameters["norm"] doesn’t have the same value as the divisor applied to A. However, this is actually on purpose!

The effective divisor applied to A is max(norm, 1), which is the norm clipped to a minimum of 1 (never allowed below 1). On the other hand, hyperparameters["norm"] holds the raw, unclipped norm.

The two only differ when norm < 1. Since the block-encoding only needs normalization to keep U(A) unitary, the code never scales A up.

The reason why you don’t want to scale A up is that BlockEncoding builds a unitary U that hides A in its top-left block, with two of the other blocks being \sqrt{I-AA^{\dagger}} and \sqrt{I-A^{\dagger}A}. These two square-root terms must be real matrices, which requires the matrices inside the roots to be positive semidefinite. This holds if and only if every singular value of A is at most 1. That is the sole reason normalization exists. You want to force A into the unit ball so that you get a valid unitary.

I hope this clarifies things. Let me know if you have any further questions!

Hi,

Thank you for your quick and instructive reply! I understand the specification of the normalization in qp.BlockEncode.

Regarding this, I hope an option to turn off the normalization because it requires an O(N^3) cost. Of course, the error due to non-unitary input matrix is responsible to the user.

Thanks again!

Thanks for your feedback on this @ttaka !

I’ll put this on our team’s radar but if it’s not already on our roadmap it may take a while to implement (we’re working hard on other projects so our capacity to work on this may be limited).

Is this blocking work for you?