From 446dc8e3d85cfbeed05b0ccbf8803d83991cdfc1 Mon Sep 17 00:00:00 2001 From: Lukas Devos Date: Thu, 16 Jan 2025 08:04:43 -0500 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Lander Burgelman <39218680+leburgel@users.noreply.github.com> --- docs/make.jl | 3 ++- src/algorithms/changebonds/svdcut.jl | 2 +- src/algorithms/changebonds/vumpssvd.jl | 2 +- src/algorithms/excitation/chepigaansatz.jl | 2 +- src/algorithms/excitation/dmrgexcitation.jl | 6 +++++- src/algorithms/groundstate/dmrg.jl | 4 ++-- src/algorithms/groundstate/idmrg.jl | 9 ++------- src/algorithms/timestep/tdvp.jl | 4 ++-- src/states/abstractmps.jl | 3 ++- 9 files changed, 18 insertions(+), 17 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index 5a0fb9f4..982ecb25 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -27,7 +27,8 @@ bib = CitationBibliography(bibpath; style=:authoryear) # interlinks links = InterLinks("TensorKit" => "https://jutho.github.io/TensorKit.jl/stable/", - "TensorOperations" => "https://jutho.github.io/TensorOperations.jl/stable/") + "TensorOperations" => "https://jutho.github.io/TensorOperations.jl/stable/", + "KrylovKit" => "https://jutho.github.io/KrylovKit.jl/stable/") # include MPSKit in all doctests DocMeta.setdocmeta!(MPSKit, :DocTestSetup, :(using MPSKit, TensorKit); recursive=true) diff --git a/src/algorithms/changebonds/svdcut.jl b/src/algorithms/changebonds/svdcut.jl index c80f2d21..330b7ef0 100644 --- a/src/algorithms/changebonds/svdcut.jl +++ b/src/algorithms/changebonds/svdcut.jl @@ -8,7 +8,7 @@ An algorithm that uses truncated SVD to change the bond dimension of a ψ. $(TYPEDFIELDS) """ @kwdef struct SvdCut <: Algorithm - "algorithm used for truncation of the gauge tensors" + "algorithm used for [truncation][@extref TensorKit.tsvd] of the gauge tensors" trscheme::TruncationScheme = notrunc() end diff --git a/src/algorithms/changebonds/vumpssvd.jl b/src/algorithms/changebonds/vumpssvd.jl index 20551f2f..83f45837 100644 --- a/src/algorithms/changebonds/vumpssvd.jl +++ b/src/algorithms/changebonds/vumpssvd.jl @@ -12,7 +12,7 @@ $(TYPEDFIELDS) tol_gauge = Defaults.tolgauge "tolerance for the eigenvalue solver" tol_eigenval = Defaults.tol - "algorithm used for truncation of the two-site update" + "algorithm used for [truncation][@extref TensorKit.tsvd] of the two-site update" trscheme::TruncationScheme = notrunc() end diff --git a/src/algorithms/excitation/chepigaansatz.jl b/src/algorithms/excitation/chepigaansatz.jl index d2b263be..374abb75 100644 --- a/src/algorithms/excitation/chepigaansatz.jl +++ b/src/algorithms/excitation/chepigaansatz.jl @@ -14,7 +14,7 @@ $(TYPEDFIELDS) ChepigaAnsatz(alg) Create a `ChepigaAnsatz` algorithm with the given eigensolver, or by passing the -keyword arguments to `Arnoldi`. +keyword arguments to [`Arnoldi`][@extref KrylovKit.Arnoldi]. ## References diff --git a/src/algorithms/excitation/dmrgexcitation.jl b/src/algorithms/excitation/dmrgexcitation.jl index 80c5f7d5..8b92dae6 100644 --- a/src/algorithms/excitation/dmrgexcitation.jl +++ b/src/algorithms/excitation/dmrgexcitation.jl @@ -1,7 +1,11 @@ """ $(TYPEDEF) -Variational optimization algorithm for excitations of finite Matrix Product States by minimizing the energy of ``H - λᵢ |ψᵢ><ψᵢ|``. +Variational optimization algorithm for excitations of finite MPS by minimizing the energy of + +```math +H - λᵢ |ψᵢ⟩⟨ψᵢ| +``` ## Fields diff --git a/src/algorithms/groundstate/dmrg.jl b/src/algorithms/groundstate/dmrg.jl index 6dceedb7..0ea686fa 100644 --- a/src/algorithms/groundstate/dmrg.jl +++ b/src/algorithms/groundstate/dmrg.jl @@ -12,7 +12,7 @@ struct DMRG{A,F} <: Algorithm tol::Float64 "maximal amount of iterations" maxiter::Int - "callback function applied after each iteration, of signature `finalize(iter, ψ, H, envs) -> ψ, envs" + "callback function applied after each iteration, of signature `finalize(iter, ψ, H, envs) -> ψ, envs`" finalize::F "setting for how much information is displayed" verbosity::Int @@ -82,7 +82,7 @@ struct DMRG2{A,F} <: Algorithm "algorithm used for the eigenvalue solvers" eigalg::A - "algorithm used for truncation of the two-site update" + "algorithm used for [truncation](@extref TensorKit.tsvd) of the two-site update" trscheme::TruncationScheme end # TODO: find better default truncation diff --git a/src/algorithms/groundstate/idmrg.jl b/src/algorithms/groundstate/idmrg.jl index 82c3f8c9..26a2d19a 100644 --- a/src/algorithms/groundstate/idmrg.jl +++ b/src/algorithms/groundstate/idmrg.jl @@ -83,12 +83,7 @@ Two-site infinite DMRG algorithm for finding the dominant eigenvector. ## Fields $(TYPEDFIELDS) -- `tol::Float64`: tolerance for convergence criterium -- `tol_gauge::Float64`: tolerance for gauging algorithm -- `eigalg::A`: eigensolver algorithm -- `maxiter::Int`: maximum number of outer iterations -- `verbosity::Int`: display progress information -- `trscheme::TruncationScheme`: truncation algorithm for [`tsvd`][TensorKit.tsvd](@extref) +- `trscheme::TruncationScheme`: truncation algorithm for [`tsvd`](@extref TensorKit.tsvd) """ struct IDMRG2{A} <: Algorithm "tolerance for convergence criterium" @@ -101,7 +96,7 @@ struct IDMRG2{A} <: Algorithm maxiter::Int "setting for how much information is displayed" verbosity::Int - "algorithm used for truncation of the two-site update" + "algorithm used for [truncation](@extref TensorKit.tsvd) of the two-site update" trscheme::TruncationScheme end function IDMRG2(; tol=Defaults.tol, tol_gauge=Defaults.tolgauge, eigalg=(;), diff --git a/src/algorithms/timestep/tdvp.jl b/src/algorithms/timestep/tdvp.jl index c39680a3..11550359 100644 --- a/src/algorithms/timestep/tdvp.jl +++ b/src/algorithms/timestep/tdvp.jl @@ -21,7 +21,7 @@ $(TYPEDFIELDS) "maximal amount of iterations for gauging algorithm" gaugemaxiter::Int = Defaults.maxiter - "callback function applied after each iteration, of signature `finalize(iter, ψ, H, envs) -> ψ, envs" + "callback function applied after each iteration, of signature `finalize(iter, ψ, H, envs) -> ψ, envs`" finalize::F = Defaults._finalize end @@ -126,7 +126,7 @@ $(TYPEDFIELDS) "algorithm used for truncation of the two-site update" trscheme::TruncationScheme = truncerr(1e-3) - "callback function applied after each iteration, of signature `finalize(iter, ψ, H, envs) -> ψ, envs" + "callback function applied after each iteration, of signature `finalize(iter, ψ, H, envs) -> ψ, envs`" finalize::F = Defaults._finalize end diff --git a/src/states/abstractmps.jl b/src/states/abstractmps.jl index b6f7d86d..f5dcfd44 100644 --- a/src/states/abstractmps.jl +++ b/src/states/abstractmps.jl @@ -5,7 +5,8 @@ Tensor types """ MPOTensor{S} -Tensor type for representing local MPO tensors, with the index convention `W ⊗ S ← N ⊗ E`. +Tensor type for representing local MPO tensors, with the index convention `W ⊗ S ← N ⊗ E`, +where `N`, `E`, `S` and `W` denote the north, east, south and west virtual spaces respectively. """ const MPOTensor{S} = AbstractTensorMap{T,S,2,2} where {T} const MPSBondTensor{S} = AbstractTensorMap{T,S,1,1} where {T}