Skip to content

Commit ee88fc2

Browse files
committed
Reorganize and limit exports
1 parent d0c4005 commit ee88fc2

File tree

6 files changed

+74
-54
lines changed

6 files changed

+74
-54
lines changed

Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ version = "0.12.0"
66
[deps]
77
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
88
BlockTensorKit = "5f87ffc2-9cf1-4a46-8172-465d160bd8cd"
9+
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
910
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
1011
HalfIntegers = "f0d1745a-41c9-11e9-1dd9-e5d34d218721"
1112
KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77"
@@ -25,6 +26,7 @@ VectorInterface = "409d34a3-91d5-4945-b6ec-7529ddf182d8"
2526
Accessors = "0.1"
2627
Aqua = "0.8.9"
2728
BlockTensorKit = "0.1.1"
29+
Compat = "3.47, 4.10"
2830
DocStringExtensions = "0.9.3"
2931
HalfIntegers = "1.6.0"
3032
KrylovKit = "0.8.3"

src/MPSKit.jl

Lines changed: 59 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,62 @@
11
module MPSKit
22

3+
# Public API
4+
# ----------
5+
# utility:
6+
export PeriodicArray, PeriodicVector, PeriodicMatrix
7+
export WindowArray
8+
export left_virtualspace, right_virtualspace, physicalspace
9+
export braille
10+
11+
# states:
12+
export FiniteMPS
13+
export InfiniteMPS
14+
export WindowMPS
15+
export MultilineMPS
16+
export QP, LeftGaugedQP, RightGaugedQP
17+
18+
# operators:
19+
export AbstractMPO
20+
export MPO, FiniteMPO, InfiniteMPO
21+
export MPOHamiltonian, FiniteMPOHamiltonian, InfiniteMPOHamiltonian
22+
export MultilineMPO
23+
export UntimedOperator, TimedOperator, MultipliedOperator, LazySum
24+
25+
# environments:
26+
export environments
27+
export leftenv, rightenv
28+
29+
# algorithms:
30+
export find_groundstate, find_groundstate!
31+
export leading_boundary
32+
export approximate, approximate!
33+
export VUMPS, VOMPS, DMRG, DMRG2, IDMRG1, IDMRG2, GradientGrassmann
34+
export excitations
35+
export FiniteExcited, QuasiparticleAnsatz, ChepigaAnsatz, ChepigaAnsatz2
36+
export time_evolve, timestep, timestep!, make_time_mpo
37+
export TDVP, TDVP2, WI, WII, TaylorCluster
38+
export changebonds, changebonds!
39+
export VUMPSSvdCut, OptimalExpand, SvdCut, RandExpand
40+
export propagator
41+
export DynamicalDMRG, NaiveInvert, Jeckelmann
42+
export exact_diagonalization, fidelity_susceptibility
43+
44+
# toolbox:
45+
export expectation_value, correlator, variance
46+
export correlation_length, marek_gap, transfer_spectrum
47+
export entropy, entanglement_spectrum
48+
export open_boundary_conditions, periodic_boundary_conditions
49+
export entanglementplot, transferplot
50+
export r_LL, l_LL, r_RR, l_RR, r_RL, r_LR, l_RL, l_LR # TODO: rename
51+
52+
# unexported
53+
using Compat: @compat
54+
@compat public DynamicTols
55+
@compat public VERBOSE_NONE, VERBOSE_WARN, VERBOSE_CONV, VERBOSE_ITER, VERBOSE_ALL
56+
@compat public IterLog, loginit!, logiter!, logfinish!, logcancel!
57+
58+
# Imports
59+
# -------
360
using TensorKit
461
using TensorKit: BraidingTensor
562
using BlockTensorKit
@@ -22,49 +79,8 @@ using Base: @kwdef
2279
using LoggingExtras
2380
using OhMyThreads
2481

25-
# bells and whistles for mpses
26-
export InfiniteMPS, FiniteMPS, WindowMPS, MultilineMPS
27-
export PeriodicArray, PeriodicVector, PeriodicMatrix, WindowArray
28-
export MPSTensor
29-
export QP, LeftGaugedQP, RightGaugedQP
30-
export r_LL, l_LL, r_RR, l_RR, r_RL, r_LR, l_RL, l_LR # should be properties
31-
32-
# useful utility functions?
33-
export add_util_leg, max_Ds, recalculate!
34-
export left_virtualspace, right_virtualspace, physicalspace
35-
export entanglementplot, transferplot
36-
export braille
37-
38-
# hamiltonian things
39-
export AbstractMPO
40-
export MPO, FiniteMPO, InfiniteMPO
41-
export MPOHamiltonian, FiniteMPOHamiltonian, InfiniteMPOHamiltonian
42-
export SparseMPO, DenseMPO, MultilineMPO
43-
export UntimedOperator, TimedOperator, MultipliedOperator, LazySum
44-
45-
export ∂C, ∂AC, ∂AC2, environments, expectation_value, effective_excitation_hamiltonian
46-
export leftenv, rightenv
47-
48-
# algos
49-
export find_groundstate!, find_groundstate, leading_boundary
50-
export VUMPS, VOMPS, DMRG, DMRG2, IDMRG1, IDMRG2, GradientGrassmann
51-
export excitations, FiniteExcited, QuasiparticleAnsatz, ChepigaAnsatz, ChepigaAnsatz2
52-
export marek_gap, correlation_length, correlator
53-
export time_evolve, timestep!, timestep
54-
export TDVP, TDVP2, make_time_mpo, WI, WII, TaylorCluster
55-
export entanglement_spectrum, transfer_spectrum, variance
56-
export changebonds!, changebonds, VUMPSSvdCut, OptimalExpand, SvdCut, RandExpand
57-
export entropy
58-
export propagator, NaiveInvert, Jeckelmann, DynamicalDMRG
59-
export fidelity_susceptibility
60-
export approximate!, approximate
61-
export periodic_boundary_conditions, open_boundary_conditions
62-
export exact_diagonalization
63-
64-
# transfer matrix
65-
export TransferMatrix
66-
export transfer_left, transfer_right
67-
82+
# Includes
83+
# --------
6884
include("algorithms/algorithm.jl")
6985

7086
# submodules

src/algorithms/grassmann.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ The module exports nothing, and all references to it should be qualified, e.g.
1111
module GrassmannMPS
1212

1313
using ..MPSKit
14-
using ..MPSKit: AbstractMPSEnvironments, InfiniteEnvironments, MultilineEnvironments, ∂∂AC
14+
using ..MPSKit: AbstractMPSEnvironments, InfiniteEnvironments, MultilineEnvironments, ∂∂AC,
15+
recalculate!
1516
using TensorKit
1617
using OhMyThreads
1718
import TensorKitManifolds.Grassmann

test/algorithms.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ end
498498
Δt = 0.1
499499
expH = make_time_mpo(H, Δt, WII())
500500

501-
O = DenseMPO(expH)
501+
O = MPSKit.DenseMPO(expH)
502502
Op = periodic_boundary_conditions(O, 10)
503503
Op′ = changebonds(Op, SvdCut(; trscheme=truncdim(5)))
504504

@@ -698,8 +698,8 @@ end
698698
dt = 1e-3
699699
sW1 = make_time_mpo(H, dt, TaylorCluster(; N=3))
700700
sW2 = make_time_mpo(H, dt, WII())
701-
W1 = DenseMPO(sW1)
702-
W2 = DenseMPO(sW2)
701+
W1 = MPSKit.DenseMPO(sW1)
702+
W2 = MPSKit.DenseMPO(sW2)
703703

704704
ψ1, _ = approximate(ψ, (sW1, ψ), VOMPS(; verbosity))
705705
ψ2, _ = approximate(ψ, (W2, ψ), VOMPS(; verbosity))

test/operators.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ end
241241

242242
ψ = InfiniteMPS([pspace], [ou pspace])
243243

244-
W = DenseMPO(make_time_mpo(ham, 1im * 0.5, WII()))
244+
W = MPSKit.DenseMPO(make_time_mpo(ham, 1im * 0.5, WII()))
245245
@test W * (W * ψ) (W * W) * ψ atol = 1e-2 # TODO: there is a normalization issue here
246246
end
247247

test/states.jl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ using ..TestSetup
99
using Test, TestExtras
1010
using MPSKit
1111
using MPSKit: _transpose_front, _transpose_tail
12+
using MPSKit: TransferMatrix
1213
using TensorKit
1314
using TensorKit:
1415

@@ -185,8 +186,8 @@ end
185186
normalize!(ψ)
186187

187188
#rand_quasiparticle is a private non-exported function
188-
ϕ₁ = MPSKit.LeftGaugedQP(rand, ψ)
189-
ϕ₂ = MPSKit.LeftGaugedQP(rand, ψ)
189+
ϕ₁ = LeftGaugedQP(rand, ψ)
190+
ϕ₂ = LeftGaugedQP(rand, ψ)
190191

191192
@test norm(axpy!(1, ϕ₁, copy(ϕ₂))) norm(ϕ₁) + norm(ϕ₂)
192193
@test norm(ϕ₁) * 3 norm(ϕ₁ * 3)
@@ -200,7 +201,7 @@ end
200201
@test norm(ϕ₁_f) norm(ϕ₁) atol = 1e-5
201202

202203
ev_f = expectation_value(ϕ₁_f, H) - expectation_value(ψ, H)
203-
ev_q = dot(ϕ₁, effective_excitation_hamiltonian(H, ϕ₁))
204+
ev_q = dot(ϕ₁, MPSKit.effective_excitation_hamiltonian(H, ϕ₁))
204205
@test ev_f ev_q atol = 1e-5
205206
end
206207

@@ -212,14 +213,14 @@ end
212213
ψ = InfiniteMPS(fill(d, period), fill(D, period))
213214

214215
#rand_quasiparticle is a private non-exported function
215-
ϕ₁ = MPSKit.LeftGaugedQP(rand, ψ)
216-
ϕ₂ = MPSKit.LeftGaugedQP(rand, ψ)
216+
ϕ₁ = LeftGaugedQP(rand, ψ)
217+
ϕ₂ = LeftGaugedQP(rand, ψ)
217218

218219
@test norm(axpy!(1, ϕ₁, copy(ϕ₂))) norm(ϕ₁) + norm(ϕ₂)
219220
@test norm(ϕ₁) * 3 norm(ϕ₁ * 3)
220221

221222
@test dot(ϕ₁,
222-
convert(MPSKit.LeftGaugedQP, convert(MPSKit.RightGaugedQP, ϕ₁)))
223+
convert(LeftGaugedQP, convert(RightGaugedQP, ϕ₁)))
223224
dot(ϕ₁, ϕ₁) atol = 1e-10
224225
end
225226
end

0 commit comments

Comments
 (0)