Gaussian state

In this example, We introduce the preparation of Gaussian state.

What is Gaussian state

Gaussian state is a nn-qubit quantum state defined as

Ψ:=1xf(x)2x=0N1f(x)x.|\Psi\rangle := \frac{1}{\sqrt{\sum_x |f(x)|^2}} \sum_{x=0}^{N-1} f(x) |x\rangle.

where f(x)=exp(βx2/2)f(x) = \exp(-\beta x^2 / 2) is the Gaussian function. Gaussian state is ubiquitous in the application of quantum algorithms in quantum chemistry, simulating quantum field theory, and quantum finance.

The equivalent problem in function approximation

One recent preprint Ref. [1] proposed a procedure for preparing Gaussian state. It leverages the block encoding of the sine value of equally spaced sample points xsin(x/N)xx\sum_x \sin(x/N)|x\rangle\langle x|. By applying quantum eigenvalue transformation on this block encoding, the Gaussian state is prepared. Consequently, the problem is reduced to finding the phase factors generating the following function

h(z)=f(arcsin(z))exp(βarcsin2(x)/2).h(z) = f(\arcsin(z)) \propto \exp(-\beta \arcsin^2(x) / 2).

where z=sin(x)z = \sin(x) transforms the domain to z[0,sin(1)]z\in [0,\sin(1)].

Setup parameters

beta = 100;
targ = @(x) exp(-beta/2 *asin(x).^2);

deg = 100;
opts.intervals=[0,sin(1)];
opts.objnorm = Inf;
opts.epsil = 0.01;
opts.npts = 500;
opts.fscale = 0.99;
opts.isplot=true;

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

Approximating the target function by polynomials

coef_full=cvx_poly_coef(targ, deg, opts); 
parity = mod(deg, 2); 
% only keep coefficients with consistent parity
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

xlist = linspace(0,sin(1),500)';
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')

Reference

  1. McArdle, S., Gilyén, A., & Berta, M. (2022). Quantum state preparation without coherent arithmetic. arXiv preprint arXiv:2210.14892.

Output of the code
norm error = 1.34851e-09
max of solution = 0.99
L-BFGS solver started 
iter          obj  stepsize des_ratio
   1  +1.1629e-02 +1.00e+00 +4.86e-01
   2  +8.0537e-03 +1.00e+00 +7.10e-01
   3  +3.8400e-03 +1.00e+00 +6.69e-01
   4  +1.6803e-03 +1.00e+00 +7.00e-01
   5  +6.2256e-04 +1.00e+00 +6.84e-01
   6  +2.1175e-04 +1.00e+00 +6.84e-01
   7  +6.3658e-05 +1.00e+00 +6.79e-01
   8  +1.6662e-05 +1.00e+00 +6.75e-01
   9  +9.0703e-06 +1.00e+00 +6.93e-01
  10  +4.0572e-06 +1.00e+00 +7.32e-01
iter          obj  stepsize des_ratio
  11  +1.3684e-06 +1.00e+00 +7.01e-01
  12  +4.1191e-07 +1.00e+00 +6.36e-01
  13  +1.6236e-07 +1.00e+00 +6.16e-01
  14  +6.8715e-08 +1.00e+00 +6.64e-01
  15  +2.1314e-08 +1.00e+00 +6.90e-01
  16  +1.1814e-08 +1.00e+00 +6.88e-01
  17  +1.5959e-09 +1.00e+00 +6.20e-01
  18  +7.3575e-11 +1.00e+00 +5.69e-01
  19  +2.3390e-12 +1.00e+00 +5.55e-01
  20  +3.8866e-13 +1.00e+00 +6.20e-01
iter          obj  stepsize des_ratio
  21  +1.5834e-14 +1.00e+00 +5.60e-01
  22  +2.1621e-16 +1.00e+00 +5.45e-01
  23  +6.4336e-19 +1.00e+00 +5.19e-01
  24  +5.0662e-21 +1.00e+00 +5.23e-01
  25  +2.1126e-22 +1.00e+00 +5.68e-01
  26  +1.1727e-24 +1.00e+00 +5.29e-01
  27  +1.1873e-26 +1.00e+00 +5.33e-01
Stop criteria satisfied.
The residual error is
   1.7719e-13

Last updated