File size: 467 Bytes
1c703f0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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