latmatcher / backend /lsquant /get_state_density.py
AndreiVoicuT's picture
Upload 85 files
1c703f0 verified
raw
history blame
1.14 kB
"""
Compute density of states.
"""
import torch
import torch as tr
import matplotlib.pyplot as plt
from evaluate_chebyshev import chepyshev_evaluate_m
from fast_math.tensor_init import init_vrand
from memory_profiler import profile
import time
@profile()
def test_ham(t, eps, dim):
ham = tr.zeros(size=(dim, dim), dtype=tr.complex128)
for i in range(dim):
ham[i][i] = eps
if i < dim - 1:
ham[i][i + 1] = t
if i > 0:
ham[i][i - 1] = t
return ham
#
# n = 10 ** 4 + 5000 # dimension of the problem
# t = 2 # t value hiper. of hamiltonian
# eps0 = 0.3 # t value hiper. of hamiltonian7
# m = 10 # cut of if the Chebyshev polinomials
#
#
# cp_t_ = []
# i_pow=[1,2,3,4, 5, 10, 100, 200, 300,500, 1000, 1500, 2000, 2100]
# for i in i_pow:
# n=10*i
# phi_ = init_vrand(n)
# ham = test_ham(t=t, eps=eps0, dim=n)
#
# start = time.time()
# cp = chepyshev_evaluate_m(phi_l=phi_, phi_r=phi_, ham=ham, m_limit=m)
# end = time.time()
# cp_t = end - start
# print("i_pow:",i)
# print("cp:", cp)
# print("time:", cp_t)
# cp_t_.append(cp_t)