Hamiltonian Simulation with QSP

Hello Everyone,

I am trying to perform Hamiltonian simulation by building a circuit using linear combinations of cos(Ht) and -isin(Ht) similar to the attached pic.

I was able to find phase factors for cos(Ht) using pyqsp and QSPPACK packages. However, I can’t seem to approximate -isin(Ht) as a polynomial (because its complex) and calculate phase factors using above packages.

I would like to know if there is any other alternative way to build -isin(Ht) by first approximating -sin(Ht) and multiply using a quantum gate to obtain -isin(Ht).

Or, is there any other way to approximate -isin(Ht) using these packages.

Thanks a lot for the assistance!

P.S: This is my code for calculating phase factors using pyqsp package.

# Import relevant modules and methods.
import matplotlib.pyplot as plt
import numpy as np
from pyqsp import angle_sequence, response
from pyqsp.poly import PolyTaylorSeries

# Specify definite-parity target function for QSP.
func = lambda x: np.sin(3 * x)
polydeg = 3  # Desired QSP protocol length.
max_scale = 0.5  # Maximum norm (<1) for rescaling.
true_func = lambda x: max_scale * func(x)  # For error, include scale.

"""
With PolyTaylorSeries class, compute Chebyshev interpolant to degree
'polydeg' (using twice as many Chebyshev nodes to prevent aliasing).
"""
poly = PolyTaylorSeries().taylor_series(
    func=func,
    degree=polydeg,
    max_scale=max_scale,
    chebyshev_basis=True,
    cheb_samples=2 * polydeg,
)

# Compute full phases (and reduced phases, parity) using symmetric QSP.
(phiset, red_phiset, parity) = angle_sequence.QuantumSignalProcessingPhases(
    poly, method="sym_qsp", chebyshev_basis=True
)

"""
Plot response according to full phases.
Note that `pcoefs` are coefficients of the approximating polynomial,
while `target` is the true function (rescaled) being approximated.
"""
response.PlotQSPResponse(
    phiset, pcoefs=poly, target=true_func, sym_qsp=True, simul_error_plot=True
)

Hi @Shehara ,

Unfortunately we’re not experts on the pyqsp nor QSPPACK packages here. We’re experts on PennyLane though, which has functionality for Quantum Signal Processing and QSVT. You can take a look at our tutorials on these topics here.

I hope these PennyLane tutorials can help you out.

To give you a little hint, apply an S gate after the first Hadamard, add a phase “i” in the black control :wink:

1 Like

Hi Catalina, Thank you so much for sharing the tutorials. I will go through them.

Thank you Guillermo, thanks a lot for the hint, yes indeed it applies the phase ‘i’, which is what I need. I will implement in Pennylane and see the results.

2 Likes

Let us know if you have any PennyLane questions @Shehara !