-
Notifications
You must be signed in to change notification settings - Fork 2
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
DBI class 3rd order GC and reduced 3rd math error #67
Comments
|
I think that it should not be an issue because with @MatteoRobbiati we are using directly the |
@Sam-XiaoyueLi can you please check if the version available in qibo is correct? |
I'm now running DBI on the master branch of qibo, if my setup is correct, I think there might be an issue.
Without modifying anything: My test code: import numpy as np
from qibo import hamiltonians, set_backend
from qibo.models.dbi.double_bracket import (
DoubleBracketGeneratorType,
DoubleBracketIteration,
)
from qibo.models.dbi.utils import *
from qibo.models.dbi.utils_scheduling import *
from qibo.models.dbi.utils_dbr_strategies import *
from qibo import hamiltonians
import matplotlib.pyplot as plt
def initialize_dbi(nqubits, model, param):
if model == "XXZ":
hamiltonian = hamiltonians.XXZ(nqubits=nqubits, delta=param)
if model == "TFIM":
hamiltonian = hamiltonians.TFIM(nqubits=nqubits, h=param)
dbi = DoubleBracketIteration(hamiltonian=hamiltonian)
return dbi
def plot_sigma_time(dbi, d, mode, s_space):
dbi.mode = mode
return [dbi.loss(step=s, d=d) for s in s_space]
dbi = initialize_dbi(5, "TFIM", 3)
dbi.cost = DoubleBracketCostFunction.off_diagonal_norm
s_space = np.linspace(1e-4,0.1,100)
modes = [DoubleBracketGeneratorType.single_commutator,
DoubleBracketGeneratorType.group_commutator,
DoubleBracketGeneratorType.group_commutator_third_order]
plots = []
for mode in modes:
plots.append(plot_sigma_time(dbi, dbi.diagonal_h_matrix, mode, s_space))
mode_names = [r'$e^{-s\hat W_k}$',
r'$\hat V^{\text{GC}}_k$',
r'$\hat V^{\text{3rd order GC}}_k$']
s_min = []
for i,mode in enumerate(modes):
plt.plot(s_space, plots[i], label=mode_names[i])
s_min.append(s_space[np.argmin(plots[i])])
# plt.xticks(s_min)
plt.ylabel(r'Off-diagonal norm $||\sigma(\hat H_{k+1})||$')
plt.xlabel(r'DBR duration $s$')
plt.legend()
plt.savefig('group_commutator.pdf') |
Thanks @Sam-XiaoyueLi for opening the issue. |
Thanks @andrea-pasquale for the reply. I have double checked by Thanks for helping me check! Maybe deleting the wrong replicate would help clarify the code? |
Oh yes, probably while fixing conflicts we have duplicated the definition by accident. |
waiting for #92 |
Pulled from main branch. In
double_bracket.py
, within functioneval_dbr_unitary
, theoperator
for when the mode isDoubleBracketGeneratorType.group_commutator_3
andDoubleBracketGeneratorType.group_commutator_3_reduced
has errors:sqrt_step
Before modification, plotting the off-diagonal norm w.r.t DBR duration
s
givesThe suggested changes are
After correcting:
The text was updated successfully, but these errors were encountered: