In this example, We introduce the implementation of singular vector transformation.
What is singular vector transformation
Singular vector transformation implements a matrix that transforms the right singular vector to the corresponding left singular vector. Suppose that we have access to a unitary U, its inverse U† and the controlled reflection operators (2Π−I), (2Π~−I). A:=Π~UΠ is of our interest and has a singular value decomposition A=∑kσk∣ϕk⟩⟨ψk∣. Singular vector transformation algorithm performs the transformation
k∑αk∣ψk⟩↦k∑αk∣ϕk⟩.
This algorithm can be used for devising a new method for singular value estimation. It also has many applications, for example, efficient ground state preparation of certain local Hamiltonians.
The equivalent problem in function approximation
As shown in the proof of Theorem 1 in [GSLW], this algorithm aims at achieving the singular value transformation of A for sign function f, that is f(SV)=∑k∣ϕk⟩⟨ψk∣.
In practice, we find an odd polynomial approximation to f, denoted as fpoly, on the interval Dκ=[−1,−δ]∪[δ,1]. By applying the singular value transformation for fpoly instead, this algorithm maps the a right singular vector having singular value at least δ to the corresponding left singular vector.
For numerical demonstration, we scale the target function by a factor of 0.8, to improve the numerical stability.
We call a subroutine to find the best odd polynomial approximating f(x) on the interval Dκ, where we solves the problem by convex optimization. Here are the parameters set for the subroutine.
opts.intervals=[delta,1];
opts.objnorm = Inf;
opts.epsil = 0.1;
opts.npts = 500;
opts.isplot= true;
opts.fscale = 1; % disable further rescaling of f(x)
delta = 0.1;
targ = @(x) 0.8*sign(x);
parity = 1;
% agrees with parity
deg = 251;
coef_full=cvx_poly_coef(targ, deg, opts);
% The solver outputs all Chebyshev coefficients while we have to post-select
% those of odd order due to the parity constraint.
coef = coef_full(1+parity:2:end);
Gilyén, A., Su, Y., Low, G. H., & Wiebe, N. (2019, June). Quantum singular value transformation and beyond: exponential improvements for quantum matrix arithmetics. In Proceedings of the 51st Annual ACM SIGACT Symposium on Theory of Computing (pp. 193-204).
Dong, Y., Meng, X., Whaley, K. B., & Lin, L. (2021). Efficient phase-factor evaluation in quantum signal processing. Physical Review A, 103(4), 042419.
Output of the code
norm error = 6.67183e-08
max of solution = 0.8
iter err
1 +4.0710e-01
2 +5.8374e-02
3 +1.8592e-03
4 +1.8744e-06
5 +1.7525e-12
Stop criteria satisfied.
The residual error is
2.8070e-13