latmatcher / backend /lsquant /evaluate_chebyshev.py
AndreiVoicuT's picture
Upload 85 files
1c703f0 verified
raw
history blame
467 Bytes
from fast_math import bra_ket, op_ket
from memory_profiler import profile
@profile()
def chepyshev_evaluate_m(phi_l, phi_r, ham, m_limit):
phi_0 = phi_r
cheb_list = [bra_ket(phi_l, phi_r)]
phi_1 = op_ket(ham, phi_0)
cheb_list.append(bra_ket(phi_l, phi_1))
for m in range(2, m_limit):
phi_2 = 2 * op_ket(ham, phi_1) - phi_0
cheb_list.append(bra_ket(phi_l, phi_2))
phi_0 = phi_1
phi_1 = phi_2
return cheb_list