QSPPACK
  • Homepage
  • Examples
    • Quantum linear system problems
    • Negative power function
    • Quantum Hamiltonian simulation
    • Quantum Gaussian filter
    • Singular value threshold projector
    • Singular vector transformation
    • Uniform singular value amplification
    • Gaussian state
    • Kaiser window state
    • Gibbs state
Powered by GitBook
On this page
  • What is singular vector transformation
  • The equivalent problem in function approximation
  • Set up parameters
  • Solving phase factors by running the solver
  • Verifying the solution
  • Reference
  1. Examples

Singular vector transformation

PreviousSingular value threshold projectorNextUniform singular value amplification

Last updated 1 year ago

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 UUU, its inverse U†U^\daggerU† and the controlled reflection operators (2Π−I)(2\Pi-I)(2Π−I), (2Π~−I)(2\tilde{\Pi}-I)(2Π~−I). A:=Π~UΠA:=\tilde{\Pi} U\PiA:=Π~UΠ is of our interest and has a singular value decomposition A=∑kσk∣ϕk⟩⟨ψk∣A=\sum_k \sigma_k |\phi_k \rangle \langle \psi_k|A=∑k​σk​∣ϕk​⟩⟨ψk​∣. Singular vector transformation algorithm performs the transformation

∑kαk∣ψk⟩↦∑kαk∣ϕk⟩.\sum_k \alpha_k|\psi_k\rangle \mapsto \sum_k \alpha_k|\phi_k\rangle.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 , this algorithm aims at achieving the singular value transformation of AAA for sign function fff, that is f(SV)=∑k∣ϕk⟩⟨ψk∣.f^{(SV)}=\sum_k |\phi_k\rangle\langle \psi_k|.f(SV)=∑k​∣ϕk​⟩⟨ψk​∣.

In practice, we find an odd polynomial approximation to fff, denoted as fpolyf_{poly}fpoly​, on the interval Dκ=[−1,−δ]∪[δ,1]D_{\kappa}=[-1, -\delta]\cup [\delta,1]Dκ​=[−1,−δ]∪[δ,1]. By applying the singular value transformation for fpolyf_{poly}fpoly​ instead, this algorithm maps the a right singular vector having singular value at least δ\deltaδ 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)f(x)f(x) on the interval DκD_{\kappa}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);

Set up parameters

opts.maxiter = 100;
opts.criteria = 1e-12;
opts.useReal = false;
opts.targetPre = true;
opts.method = 'Newton';

Solving phase factors by running the solver

[phi_proc,out] = QSP_solver(coef,parity,opts);

Verifying the solution

xlist1 = linspace(-1,-delta,500)';
xlist2 = linspace(delta,1,500)';
xlist = cat(1, xlist1,xlist2);
func = @(x) ChebyCoef2Func(x, coef, parity, true);
targ_value = targ(xlist);
func_value = func(xlist);
QSP_value = QSPGetEntry(xlist, phi_proc, out);
err= norm(QSP_value-func_value, 2);
disp('The residual error is');


disp(err);
figure()
plot(xlist,QSP_value-func_value)
xlabel('$$x$$', 'Interpreter', 'latex')
ylabel('$$g(x,\Phi^*)-f_\mathrm{poly}(x)$$', 'Interpreter', 'latex')
print(gcf,'singular_vector_transformation_error.png','-dpng','-r500');

Reference

  1. 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).

  2. 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
[GSLW]
Polynomial approximation of the target function
Polynomial approximation error
The point-wise error of the solved phase factors.