Skip to content

Commit 420af8b

Browse files
committed
Formatting changes
1 parent c69aa13 commit 420af8b

File tree

18 files changed

+58
-50
lines changed

18 files changed

+58
-50
lines changed

examples/classic2d/1.hard-hexagon/main.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ Additionally, we can compute the entanglement entropy as well as the correlation
3939
D = 10
4040
V = virtual_space(D)
4141
ψ₀ = InfiniteMPS([P], [V])
42-
ψ, envs, = leading_boundary(ψ₀, mpo,
43-
VUMPS(; verbosity=0,
44-
alg_eigsolve=MPSKit.Defaults.alg_eigsolve(;
45-
ishermitian=false))) # use non-hermitian eigensolver
42+
ψ, envs = leading_boundary(ψ₀, mpo,
43+
VUMPS(; verbosity=0,
44+
alg_eigsolve=MPSKit.Defaults.alg_eigsolve(;
45+
ishermitian=false))) # use non-hermitian eigensolver
4646
F = real(expectation_value(ψ, mpo))
4747
S = real(first(entropy(ψ)))
4848
ξ = correlation_length(ψ)
@@ -63,13 +63,13 @@ function scaling_simulations(ψ₀, mpo, Ds; verbosity=0, tol=1e-6,
6363
correlations = similar(Ds, Float64)
6464
alg = VUMPS(; verbosity, tol, alg_eigsolve)
6565

66-
ψ, envs, = leading_boundary(ψ₀, mpo, alg)
66+
ψ, envs = leading_boundary(ψ₀, mpo, alg)
6767
entropies[1] = real(entropy(ψ)[1])
6868
correlations[1] = correlation_length(ψ)
6969

7070
for (i, d) in enumerate(diff(Ds))
7171
ψ, envs = changebonds(ψ, mpo, OptimalExpand(; trscheme=truncdim(d)), envs)
72-
ψ, envs, = leading_boundary(ψ, mpo, alg, envs)
72+
ψ, envs = leading_boundary(ψ, mpo, alg, envs)
7373
entropies[i + 1] = real(entropy(ψ)[1])
7474
correlations[i + 1] = correlation_length(ψ)
7575
end

examples/quantum1d/7.xy-finiteT/main.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ J = 1 / 2
2929
T = ComplexF64
3030
symmetry = U1Irrep
3131

32-
function XY_hamiltonian(::Type{T}=ComplexF64, ::Type{S}=Trivial; J=1 / 2,
32+
function XY_hamiltonian((::Type{T})=ComplexF64, (::Type{S})=Trivial; J=1 / 2,
3333
N) where {T<:Number,S<:Sector}
3434
spin = 1 // 2
3535
term = J * (S_xx(T, S; spin) + S_yy(T, S; spin))
@@ -90,7 +90,7 @@ D = 64
9090
V_init = symmetry === Trivial ?^32 : U1Space(i => 10 for i in -1:(1 // 2):1)
9191
psi_init = FiniteMPS(N, physicalspace(H, 1), V_init)
9292
trscheme = truncdim(D)
93-
psi, envs, = find_groundstate(psi_init, H, DMRG2(; trscheme, maxiter=5));
93+
psi, envs = find_groundstate(psi_init, H, DMRG2(; trscheme, maxiter=5));
9494
E_0 = expectation_value(psi, H, envs) / N
9595

9696
println("Numerical:\t", real(E_0))

src/algorithms/approximate/fvomps.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function approximate!(ψ::AbstractFiniteMPS, Oϕ, alg::DMRG2,
99
ϵ = 0.0
1010
for pos in [1:(length(ψ) - 1); (length(ψ) - 2):-1:1]
1111
AC2′ = AC2_projection(pos, ψ, Oϕ, envs)
12-
al, c, ar, = tsvd!(AC2′; trunc=alg.trscheme)
12+
al, c, ar = tsvd!(AC2′; trunc=alg.trscheme)
1313

1414
AC2 = ψ.AC[pos] * _transpose_tail.AR[pos + 1])
1515
ϵ = max(ϵ, norm(al * c * ar - AC2) / norm(AC2))

src/algorithms/approximate/idmrg.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function approximate!(ψ::MultilineMPS, toapprox::Tuple{<:MultilineMPO,<:Multili
7474
for col in 1:size(ψ, 2)
7575
for row in 1:size(ψ, 1)
7676
AC2′ = AC2_projection(CartesianIndex(row, col), ψ, toapprox, envs)
77-
al, c, ar, = tsvd!(AC2′; trunc=alg.trscheme, alg=alg.alg_svd)
77+
al, c, ar = tsvd!(AC2′; trunc=alg.trscheme, alg=alg.alg_svd)
7878
normalize!(c)
7979

8080
ψ.AL[row + 1, col] = al
@@ -93,7 +93,7 @@ function approximate!(ψ::MultilineMPS, toapprox::Tuple{<:MultilineMPO,<:Multili
9393
# TODO: also write this as AC2_projection?
9494
AC2 = ϕ.AL[row, col] * _transpose_tail.AC[row, col + 1])
9595
AC2′ = AC2_hamiltonian(CartesianIndex(row, col), ψ, O, ϕ, envs) * AC2
96-
al, c, ar, = tsvd!(AC2′; trunc=alg.trscheme, alg=alg.alg_svd)
96+
al, c, ar = tsvd!(AC2′; trunc=alg.trscheme, alg=alg.alg_svd)
9797
normalize!(c)
9898

9999
ψ.AL[row + 1, col] = al

src/algorithms/changebonds/optimalexpand.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function changebonds(ψ::InfiniteMPS, H::InfiniteMPOHamiltonian, alg::OptimalExp
3131
VL = leftnull.AL[i])
3232
VR = rightnull!(_transpose_tail.AR[i + 1]))
3333
intermediate = normalize!(adjoint(VL) * AC2 * adjoint(VR))
34-
U, _, V, = tsvd!(intermediate; trunc=alg.trscheme, alg=alg.alg_svd)
34+
U, _, V = tsvd!(intermediate; trunc=alg.trscheme, alg=alg.alg_svd)
3535

3636
AL′[i] = VL * U
3737
AR′[i + 1] = V * VR
@@ -57,7 +57,7 @@ function changebonds(ψ::MultilineMPS, H, alg::OptimalExpand, envs=environments(
5757
VL = leftnull.AL[i, j])
5858
VR = rightnull!(_transpose_tail.AR[i, j + 1]))
5959
intermediate = normalize!(adjoint(VL) * AC2 * adjoint(VR))
60-
U, _, V, = tsvd!(intermediate; trunc=alg.trscheme, alg=alg.alg_svd)
60+
U, _, V = tsvd!(intermediate; trunc=alg.trscheme, alg=alg.alg_svd)
6161

6262
AL′[i, j] = VL * U
6363
AR′[i, j + 1] = V * VR
@@ -88,7 +88,7 @@ function changebonds!(ψ::AbstractFiniteMPS, H, alg::OptimalExpand, envs=environ
8888

8989
#Use this nullspaces and SVD decomposition to determine the optimal expansion space
9090
intermediate = normalize!(adjoint(NL) * AC2 * adjoint(NR))
91-
_, _, V, = tsvd!(intermediate; trunc=alg.trscheme, alg=alg.alg_svd)
91+
_, _, V = tsvd!(intermediate; trunc=alg.trscheme, alg=alg.alg_svd)
9292

9393
ar_re = V * NR
9494
ar_le = zerovector!(similar(ar_re, codomain.AC[i]) space(V, 1)))

src/algorithms/changebonds/randexpand.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function changebonds(ψ::InfiniteMPS, alg::RandExpand)
2929
VL = leftnull.AL[i])
3030
VR = rightnull!(_transpose_tail.AR[i + 1]))
3131
intermediate = normalize!(adjoint(VL) * AC2 * adjoint(VR))
32-
U, _, V, = tsvd!(intermediate; trunc=alg.trscheme, alg=alg.alg_svd)
32+
U, _, V = tsvd!(intermediate; trunc=alg.trscheme, alg=alg.alg_svd)
3333

3434
AL′[i] = VL * U
3535
AR′[i + 1] = V * VR
@@ -53,7 +53,7 @@ function changebonds!(ψ::AbstractFiniteMPS, alg::RandExpand)
5353

5454
#Use this nullspaces and SVD decomposition to determine the optimal expansion space
5555
intermediate = normalize!(adjoint(NL) * AC2 * adjoint(NR))
56-
_, _, V, = tsvd!(intermediate; trunc=alg.trscheme, alg=alg.alg_svd)
56+
_, _, V = tsvd!(intermediate; trunc=alg.trscheme, alg=alg.alg_svd)
5757

5858
ar_re = V * NR
5959
ar_le = zerovector!(similar(ar_re, codomain.AC[i]) space(V, 1)))

src/algorithms/changebonds/svdcut.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function changebonds(ψ::AbstractFiniteMPS, alg::SvdCut; kwargs...)
2020
end
2121
function changebonds!::AbstractFiniteMPS, alg::SvdCut; normalize::Bool=true)
2222
for i in (length(ψ) - 1):-1:1
23-
U, S, V, = tsvd.C[i]; trunc=alg.trscheme, alg=alg.alg_svd)
23+
U, S, V = tsvd.C[i]; trunc=alg.trscheme, alg=alg.alg_svd)
2424
AL′ = ψ.AL[i] * U
2525
ψ.AC[i] = (AL′, complex(S))
2626
AR′ = _transpose_front(V * _transpose_tail.AR[i + 1]))
@@ -44,7 +44,7 @@ function changebonds!(mpo::FiniteMPO, alg::SvdCut)
4444
O_left = transpose(mpo[1], ((3, 1, 2), (4,)))
4545
local O_right
4646
for i in 2:length(mpo)
47-
U, S, V, = tsvd!(O_left; trunc=alg.trscheme, alg=alg.alg_svd)
47+
U, S, V = tsvd!(O_left; trunc=alg.trscheme, alg=alg.alg_svd)
4848
@inbounds mpo[i - 1] = transpose(U, ((2, 3), (1, 4)))
4949
if i < length(mpo)
5050
@plansor O_left[-3 -1 -2; -4] := S[-1; 1] * V[1; 2] * mpo[i][2 -2; -3 -4]
@@ -55,7 +55,7 @@ function changebonds!(mpo::FiniteMPO, alg::SvdCut)
5555

5656
# right to left
5757
for i in (length(mpo) - 1):-1:1
58-
U, S, V, = tsvd!(O_right; trunc=alg.trscheme, alg=alg.alg_svd)
58+
U, S, V = tsvd!(O_right; trunc=alg.trscheme, alg=alg.alg_svd)
5959
@inbounds mpo[i + 1] = transpose(V, ((1, 4), (2, 3)))
6060
if i > 1
6161
@plansor O_right[-1; -3 -4 -2] := mpo[i][-1 -2; -3 2] * U[2; 1] * S[1; -4]
@@ -84,7 +84,7 @@ function changebonds(ψ::InfiniteMPS, alg::SvdCut)
8484
ncr = ψ.C[1]
8585

8686
for i in 1:length(ψ)
87-
U, ncr, = tsvd.C[i]; trunc=alg.trscheme, alg=alg.alg_svd)
87+
U, ncr = tsvd.C[i]; trunc=alg.trscheme, alg=alg.alg_svd)
8888
copied[i] = copied[i] * U
8989
copied[i + 1] = _transpose_front(U' * _transpose_tail(copied[i + 1]))
9090
end

src/algorithms/excitation/chepigaansatz.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ function excitations(H, alg::ChepigaAnsatz2, ψ::FiniteMPS, envs=environments(ψ
117117
# map back to finitemps
118118
ψs = map(AC2s) do ac
119119
ψ′ = copy(ψ)
120-
AL, C, AR, = tsvd!(ac; trunc=alg.trscheme)
120+
AL, C, AR = tsvd!(ac; trunc=alg.trscheme)
121121
normalize!(C)
122122
ψ′.AC[pos] = (AL, complex(C))
123123
ψ′.AC[pos + 1] = (complex(C), _transpose_front(AR))

src/algorithms/groundstate/dmrg.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ function find_groundstate!(ψ::AbstractFiniteMPS, H, alg::DMRG2, envs=environmen
121121
Hac2 = AC2_hamiltonian(pos, ψ, H, ψ, envs)
122122
_, newA2center = fixedpoint(Hac2, ac2, :SR, alg_eigsolve)
123123

124-
al, c, ar, = tsvd!(newA2center; trunc=alg.trscheme, alg=alg.alg_svd)
124+
al, c, ar = tsvd!(newA2center; trunc=alg.trscheme, alg=alg.alg_svd)
125125
normalize!(c)
126126
v = @plansor ac2[1 2; 3 4] * conj(al[1 2; 5]) * conj(c[5; 6]) *
127127
conj(ar[6; 3 4])
@@ -137,7 +137,7 @@ function find_groundstate!(ψ::AbstractFiniteMPS, H, alg::DMRG2, envs=environmen
137137
Hac2 = AC2_hamiltonian(pos, ψ, H, ψ, envs)
138138
_, newA2center = fixedpoint(Hac2, ac2, :SR, alg_eigsolve)
139139

140-
al, c, ar, = tsvd!(newA2center; trunc=alg.trscheme, alg=alg.alg_svd)
140+
al, c, ar = tsvd!(newA2center; trunc=alg.trscheme, alg=alg.alg_svd)
141141
normalize!(c)
142142
v = @plansor ac2[1 2; 3 4] * conj(al[1 2; 5]) * conj(c[5; 6]) *
143143
conj(ar[6; 3 4])

src/algorithms/groundstate/gradient_grassmann.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ struct GradientGrassmann{O<:OptimKit.OptimizationAlgorithm,F} <: Algorithm
3434

3535
function GradientGrassmann(; method=ConjugateGradient, (finalize!)=OptimKit._finalize!,
3636
tol=Defaults.tol, maxiter=Defaults.maxiter,
37-
verbosity=Defaults.verbosity - 1)
37+
verbosity=(Defaults.verbosity - 1))
3838
if isa(method, OptimKit.OptimizationAlgorithm)
3939
# We were given an optimisation method, just use it.
4040
m = method

0 commit comments

Comments
 (0)