Calculate Chebychev moments.
(At least) three kinds of moments can be distinguished: - expectation values of the form <a|T_n(H)|b> - expectation values with a==b, <a|T_n(H)|a> (able to yield 2 moments per loop) - traces Tr[A*T_n(H)] (do averaging in high-level module using the above?)
Right now, only the second kind <a|T_n(H)|a> is implemented, which is needed to calculate the local density of states (LDOS).
Calculate Chebychev moments for expectation values of the form <a|T_n(H)|a> for a certain state vector |a> “state” and a Hamiltonian matrix H “mat”. Specify required number of moments “limit” (truncation limit). If “out” is not None, store the results in “out” instead of returning them.
It is recommended to provide the matrix in the CSR sparse matrix format, since this is the best and fastest format for the matrix-vector multiplication which is the very heart of every KPM algorithm.
This function only delegates the work to the corresponding low-level functions, all beginning with “_expec_”. If no optimal low-level function is found for the given datatype, the plain Python implementation “_expec” is used (TO DO).
If “omp” is True, use available OpenMP-parallelized variants of the algorithms. If “num_threads” is not None, set the number of threads accordingly. If “num_threads” is smaller than 1, determine the number of processor cores automatically.