Skip to content

Commit

Permalink
Minor Typo Corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
cohensbw committed Sep 19, 2024
1 parent c63620b commit 15619d8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
9 changes: 4 additions & 5 deletions examples/usage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# ```math
# f(\epsilon) = \frac{1}{1+e^{\beta (\epsilon-\mu)}} = \frac{1}{2} \left[ 1 + \tanh\left(\tfrac{\beta(\epsilon-\mu)}{2}\right) \right]
# ```
# is the Fermi function, with ``\beta = 1/T`` is the inverse temperature and ``\mu`` is the chemical potential.
# is the Fermi function, with ``\beta = 1/T`` the inverse temperature and ``\mu`` the chemical potential.
# Here we will applying the kernel polynomial method (KPM) algorithm to approximate the density matrix ``\rho`` by
# a Chebyshev polynomial expansion.

Expand Down Expand Up @@ -58,10 +58,9 @@ fermi(ϵ, μ, β) = (1+tanh(β*(ϵ-μ)/2))/2
ρ = U * Diagonal(fermi.(ϵ, μ, β)) * adjoint(U)

# Now let use the KPM to approximate ``\rho``. We will need to define the order ``M`` of the expansion
# and give approximate bounds for the egenspectrum of ``H``, making sure to overestimate the the true
# interval spanned by the egienvalues of ``H``. Note that because we are considering the simple
# non-interacting model here, the exact eigenspectrum of ``H`` is known and spans
# the interval ``\epsilon \in [-2t, 2t].``
# and give approximate bounds for the eigenspectrum of ``H``, making sure to overestimate the the true
# interval spanned by the eigenvalues of ``H``. Because we are considering the simple non-interacting model,
# the exact eigenspectrum of ``H`` is known and spans the interval ``\epsilon \in [-2t, 2t].``

## Define eigenspectrum bounds.
bounds = (-3.0t, 3.0t)
Expand Down
18 changes: 18 additions & 0 deletions src/lanczos.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ Note that the [`eigmin`](https://docs.julialang.org/en/v1/stdlib/LinearAlgebra/#
and [`eigmax`](https://docs.julialang.org/en/v1/stdlib/LinearAlgebra/#LinearAlgebra.eigmax) routines have
[specialized implementations](https://docs.julialang.org/en/v1/stdlib/LinearAlgebra/#Elementary-operations) for a
[`SymTridiagonal`](https://docs.julialang.org/en/v1/stdlib/LinearAlgebra/#LinearAlgebra.SymTridiagonal) matrix type.
# Similar generalizations of Lanczos have been considered in [2] and [3].
#
# 1. C. C. Paige, IMA J. Appl. Math., 373-381 (1972),
# https://doi.org/10.1093%2Fimamat%2F10.3.373.
# 2. H. A. van der Vorst, Math. Comp. 39, 559-561 (1982),
# https://doi.org/10.1090/s0025-5718-1982-0669648-0
# 3. M. Grüning, A. Marini, X. Gonze, Comput. Mater. Sci. 50, 2148-2156 (2011),
# https://doi.org/10.1016/j.commatsci.2011.02.021.
"""
function lanczos(niters, v, A, S = I, rng = Random.default_rng())

Expand Down Expand Up @@ -67,6 +76,15 @@ based on the contents of the vectors `αs` and `βs`. Note that the [`eigmin`](h
and [`eigmax`](https://docs.julialang.org/en/v1/stdlib/LinearAlgebra/#LinearAlgebra.eigmax) routines have
[specialized implementations](https://docs.julialang.org/en/v1/stdlib/LinearAlgebra/#Elementary-operations) for a
[`SymTridiagonal`](https://docs.julialang.org/en/v1/stdlib/LinearAlgebra/#LinearAlgebra.SymTridiagonal) matrix type.
# Similar generalizations of Lanczos have been considered in [2] and [3].
#
# 1. C. C. Paige, IMA J. Appl. Math., 373-381 (1972),
# https://doi.org/10.1093%2Fimamat%2F10.3.373.
# 2. H. A. van der Vorst, Math. Comp. 39, 559-561 (1982),
# https://doi.org/10.1090/s0025-5718-1982-0669648-0
# 3. M. Grüning, A. Marini, X. Gonze, Comput. Mater. Sci. 50, 2148-2156 (2011),
# https://doi.org/10.1016/j.commatsci.2011.02.021.
"""
function lanczos!(
αs::AbstractVector, βs::AbstractVector, v::AbstractVector,
Expand Down

0 comments on commit 15619d8

Please sign in to comment.