1. Inputs: the decomposition (19) of H, parameterized quantum circuits $U({\boldsymbol{\theta }})$ with initial parameters ${\boldsymbol{\theta }}$, and error tolerance ε. |
2. For any $1\leqslant i\leqslant n$, applying the Hadamard test in figure 4 to compute the value: |
${f}_{i}({\boldsymbol{\theta }})=\displaystyle \frac{1}{2}\left(\mathrm{tr}({U}_{i}U({\boldsymbol{\theta }}))+\mathrm{tr}({U}^{\dagger }({\boldsymbol{\theta }}){U}_{i}^{\dagger })\right).$ (20) |
3. Compute the value of loss function: |
${l}_{3}({\boldsymbol{\theta }})=\sum _{i=1}^{n}{k}_{i}{f}_{i}({\boldsymbol{\theta }}).$ (21) |
4. Perform optimization process to maximize ${l}_{3}({\boldsymbol{\theta }})$, update ${\boldsymbol{\theta }}$. |
5. Repeat steps 2–4, until the loss function satisfies $| {\rm{\Delta }}{l}_{3}({\boldsymbol{\theta }})| \leqslant \epsilon $. |