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 value threshold projector
  • The equivalent problem in function approximation
  • Set up parameters
  • Solving polynomial approximation
  • Solving phase factors by running the solver
  • Verifying the solution
  • Reference
  1. Examples

Singular value threshold projector

In this example, We introduce the implementation of singular value threshold projector.

What is singular value threshold projector

Singular value threshold projectors project out singular vectors with singular values below/above a certain threshold. 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=WΣVA=W\Sigma VA=WΣV. For S⊂RS\subset RS⊂R let ΣS\Sigma_SΣS​ be the matrix obtained from Σ\SigmaΣ by replacing all diagonal entries Σii∈S\Sigma_{ii}\in SΣii​∈S by 1 and all diagonal entries Σii∉S\Sigma_{ii}\notin SΣii​∈/S by 0. We define ΠS:=ΠVΣSV†Π\Pi_S:=\Pi V\Sigma_S V^{\dagger}\PiΠS​:=ΠVΣS​V†Π and similarly Π~S:=Π~WΣSW†Π~\tilde{\Pi}_S:=\tilde{\Pi} W\Sigma_S W^{\dagger}\tilde{\Pi}Π~S​:=Π~WΣS​W†Π~. For example, set S=[0,δ]S=[0,\delta]S=[0,δ] and ΠS\Pi_SΠS​ projects out right singular vectors with singular value at most δ\deltaδ. These threshold projectors play a major role in quantum algorithms.

The equivalent problem in function approximation

As an example, we implement Π[0,0.5]\Pi_{[0,0.5]}Π[0,0.5]​. We need to implement singular value transformation of AAA for the following rectangle function. We call a subroutine to find the best even polynomial approximating f(x)f(x)f(x) on the interval Dδ=[0,0.5−δ]∪[0.5+δ,1].D_{\delta}=[0, 0.5-\delta]\cup [0.5+\delta,1].Dδ​=[0,0.5−δ]∪[0.5+δ,1]. We solve the problem by convex optimization. Here are the parameters set for the subroutine.

Set up parameters

opts.intervals=[0,0.5-delta,0.5+delta,1];
opts.objnorm = Inf;
opts.epsil = 0.1;
opts.npts = 500;
opts.isplot= true;
% scaling factor for the infinity norm
opts.fscale = 0.9;
opts.maxiter = 100;
opts.criteria = 1e-12;
opts.useReal = false;
opts.targetPre = true;
opts.method = 'Newton';

Solving polynomial approximation

targ = @(x) rectangularPulse(-0.5,0.5,x);
% Compute its Chebyshev coefficients. 
parity = 0;
deg = 250;
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);

Solving phase factors by running the solver

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

Verifying the solution

xlist1 = linspace(0,0.5-delta,500)';
xlist2 = linspace(0.5+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,Inf);
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_value_threshold_projectors_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.5514e-08
max of solution = 0.9
iter          err
   1  +4.8369e-01 
   2  +1.9791e-01 
   3  +2.7179e-02 
   4  +3.0099e-04 
   5  +3.2263e-08 
Stop criteria satisfied.
The residual error is
   3.3529e-14
PreviousQuantum Gaussian filterNextSingular vector transformation

Last updated 1 year ago

Polynomial approximation of the target function
Polynomial approximation error
The point-wise error of the solved phase factors.