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 μ. 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 H, the quantum Gaussian filter is
exp(−(H−μI)2/σ2).
Here, μ is the parameter for location and σ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 0≺H≺I. The interval of interest becomes x∈(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). Extending this function as an even function, the target of the approximation is
f(x)∝exp(−(∣x∣−μ)2/σ2).
Because the eigenvalue of the Hamiltonian is in x∈(0,1), it suffices to implement the quantum Gaussian filter f(H)∝exp(−(H−μI)2/σ2).
In numerical demonstration, we consider an even function f(x)=0.99∗e−(∣x∣−0.5)2/0.12whose L∞ norm over [−1,1] is strictly bounded by 0.99≈1, which is very close to the fully-coherent regime ∥f∥∞≈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;
Lin, L., & Tong, Y. (2020). Optimal polynomial based quantum eigenstate filtering with application to solving quantum linear systems. Quantum, 4, 361.
Lin, L., & Tong, Y. (2020). Near-optimal ground state preparation. Quantum, 4, 372.
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