Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XXZ_EvolutionOracle not passing arguments #68

Closed
Sam-XiaoyueLi opened this issue Jul 15, 2024 · 3 comments
Closed

XXZ_EvolutionOracle not passing arguments #68

Sam-XiaoyueLi opened this issue Jul 15, 2024 · 3 comments
Assignees
Labels

Comments

@Sam-XiaoyueLi
Copy link
Contributor

On branch refactor_again, setting base_oracle = XXZ_EvolutionOracle.from_nqubits(nqubits=5, delta=0.5, steps=3, order=1)
I believe that https://github.com/qiboteam/boostvqe/blob/e5d458d5d591530f24ce87510d90608991c640da/src/boostvqe/models/dbi/double_bracket_evolution_oracles.py#L274C1-L295C10
is not passing steps and order
since
image
This will cause the oracle's circuit to be different from nqubit_XXZ_decomposition. To see this, you may run

from qibo import hamiltonians
import numpy as np
from boostvqe.compiling_XXZ import *

t = 0.01
steps = 3
delta = 0.5
nqubits = 5
order = 1

h_xxz = hamiltonians.XXZ(nqubits=nqubits, delta = delta)
base_oracle = XXZ_EvolutionOracle.from_nqubits(
    nqubits=nqubits, delta=delta, steps=steps, order=1
)

diff_norms = []
times = np.linspace(0,3,30)
for t in times:
    u = h_xxz.exp(t)
    circ = nqubit_XXZ_decomposition(nqubits=nqubits, t=t, delta=delta, steps=steps, order=order)
    diff_norms.append(np.linalg.norm(base_oracle.circuit(t).unitary() - circ.unitary()))

import matplotlib.pyplot as plt

plt.plot(times, diff_norms)

the correct plot would be a straight line 0, but we get:
image

@andrea-pasquale
Copy link
Collaborator

Thanks @Sam-XiaoyueLi for spotting the issue. I've fixed it in da648a0.
Only steps was not passed correctly because it was ovewritten by the class EvolutionOracle. order is passed correctly.
By running your script above (btw you forgot to import XXZ_EvolutionOracle :D ), I'm now getting a straight line as expected
image

@marekgluza marekgluza added the bug Something isn't working label Oct 15, 2024
@marekgluza
Copy link
Contributor

Most likely #92 will close this

@marekgluza
Copy link
Contributor

Actually it's merged in #63, thanks Andrea!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants