Quantum Gaussian filter

In this example, We introduce the implementation of quantum Gaussian filter.

What is quantum Gaussian filter

Gaussian filter is a function localized around the parameter μ\mu. Interpreting this parameter as the desired energy level, the quantum Gaussian filter is an operator of the system Hamiltonian which acts as the projection onto an energy subspace near it. Given a Hamiltonian HH, the quantum Gaussian filter is

exp((HμI)2/σ2).\exp(-(H-\mu I)^2/\sigma^2).

Here, μ\mu is the parameter for location and σ2\sigma^2controls the width.

Quantum Gaussian filter is used as a useful subroutine in preparing ground state and solving linear system problems. We refer the interested readers to Ref. [1, 2] for more details.

The equivalent problem in function approximation

Suppose the Hamiltonian is normalized and shifted so that 0HI0 \prec H \prec I. The interval of interest becomes x(0,1)x \in (0, 1). Hence, we only need to approximate the following function accurately in the positive half interval to implement the quantum Gaussian filter f(x)exp((xμ)2/σ2)f(x) \propto \exp(- (x - \mu)^2 / \sigma^2). Extending this function as an even function, the target of the approximation is

f(x)exp((xμ)2/σ2).f(x) \propto \exp(-(|x|-\mu)^2 / \sigma^2).

Because the eigenvalue of the Hamiltonian is in x(0,1)x \in (0, 1), it suffices to implement the quantum Gaussian filter f(H)exp((HμI)2/σ2)f(H) \propto \exp(-(H-\mu I)^2/\sigma^2).

In numerical demonstration, we consider an even function f(x)=0.99e(x0.5)2/0.12f(x) = 0.99 * e^{-(|x|-0.5)^2/0.1^2}whose LL^{\infty} norm over [1,1][-1,1] is strictly bounded by 0.9910.99 \approx 1, which is very close to the fully-coherent regime f1\Vert f \Vert_\infty \approx 1.

parity = 0;
targ = @(x) 0.99 * exp(-(abs(x)-0.5).^2/0.1^2);
% Compute its Chebyshev coefficients. 
d = 100;
% The second parameter of chebfun should be degree + 1.
% The function chebfun(F, N) characterizes the function F on a size-N grid
% by interpolation. Thus, the degree of the interpolated polynomial is N - 1.
f = chebfun(targ,d + 1);
coef = chebcoeffs(f);
% Only need part of Chebyshev coefficients.
coef = coef(parity+1:2:end);
visualizing polynomial approximation error
figure()
hold on
targ_value = targ(xlist);
plot(xlist,targ_value,'b-','linewidth',2)
plot(xlist,func_value,'-.')
hold off
xlabel('$x$', 'Interpreter', 'latex')
ylabel('$f(x)$', 'Interpreter', 'latex')
legend('target',  'polynomial',...
  'location','se')

figure()
plot(xlist,func_value-targ_value)
xlabel('$x$', 'Interpreter', 'latex')
ylabel('$f_\mathrm{poly}(x)-f(x)$', 'Interpreter', 'latex')

Set up parameters

opts.maxiter = 100;
opts.criteria = 1e-12;
opts.targetPre = true;
opts.method = 'Newton';
% use the real representation to speed up the computation
opts.useReal = true;

Solving phase factors by running the solver

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

Verifying the solution

xlist = linspace(0,1,1000)';
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,'quantum_gaussian_filter_error.png','-dpng','-r500');

Reference

  1. Lin, L., & Tong, Y. (2020). Optimal polynomial based quantum eigenstate filtering with application to solving quantum linear systems. Quantum, 4, 361.

  2. Lin, L., & Tong, Y. (2020). Near-optimal ground state preparation. Quantum, 4, 372.

  3. 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
iter          err
   1  +2.0557e-01 
   2  +4.6388e-02 
   3  +8.9034e-03 
   4  +8.8606e-04 
   5  +1.3739e-05 
   6  +3.5193e-09 
Stop criteria satisfied.
The residual error is
   8.4377e-15

Last updated