Skip to content

Commit 08b134d

Browse files
authored
Format and update workflows (#138)
1 parent 03520b6 commit 08b134d

File tree

13 files changed

+34
-16
lines changed

13 files changed

+34
-16
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: "Format Pull Request"
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
workflow_dispatch:
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
format-pull-request:
13+
name: "Format Pull Request"
14+
uses: "ITensor/ITensorActions/.github/workflows/FormatPullRequest.yml@main"

.pre-commit-config.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
ci:
2+
skip: [julia-formatter]
3+
14
repos:
25
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.5.0
6+
rev: v5.0.0
47
hooks:
58
- id: check-merge-conflict
69
- id: check-toml
@@ -9,6 +12,6 @@ repos:
912
exclude_types: [markdown] # incompatible with Literate.jl
1013

1114
- repo: "https://github.com/domluna/JuliaFormatter.jl"
12-
rev: v1.0.62
15+
rev: v2.1.0
1316
hooks:
1417
- id: "julia-formatter"

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ITensorMPS"
22
uuid = "0d1a4710-d33b-49a5-8f18-73bdf49b47e2"
33
authors = ["Matthew Fishman <[email protected]>", "Miles Stoudenmire <[email protected]>"]
4-
version = "0.3.16"
4+
version = "0.3.17"
55

66
[deps]
77
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"

src/abstractmps.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ end
694694
# TODO: change kwarg from `set_limits` to `preserve_ortho`
695695
function map!(f::Function, M::AbstractMPS; set_limits::Bool=true)
696696
for i in eachindex(M)
697-
M[i, set_limits=set_limits] = f(M[i])
697+
M[i, set_limits = set_limits] = f(M[i])
698698
end
699699
return M
700700
end
@@ -1306,7 +1306,7 @@ of the orthogonality center to avoid numerical overflow in the case of diverging
13061306
See also [`normalize!`](@ref), [`norm`](@ref), [`lognorm`](@ref).
13071307
"""
13081308
function normalize(M::AbstractMPS; (lognorm!)=[])
1309-
return normalize!(deepcopy_ortho_center(M); (lognorm!)=lognorm!)
1309+
return normalize!(deepcopy_ortho_center(M); (lognorm!)=(lognorm!))
13101310
end
13111311

13121312
"""
@@ -2001,7 +2001,7 @@ function swapbondsites(ψ::AbstractMPS, b::Integer; ortho="right", kwargs...)
20012001
elseif rightlim(ψ) > b + 2
20022002
ψ = orthogonalize(ψ, b + 1)
20032003
end
2004-
ψ[b:(b + 1), orthocenter=orthocenter, perm=[2, 1], kwargs...] = ψ[b] * ψ[b + 1]
2004+
ψ[b:(b + 1), orthocenter = orthocenter, perm = [2, 1], kwargs...] = ψ[b] * ψ[b + 1]
20052005
return ψ
20062006
end
20072007

src/lib/Experimental/src/dmrg.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function dmrg(
1010
operator, init::MPS; updater=eigsolve_updater, (observer!)=default_observer(), kwargs...
1111
)
1212
info_ref! = Ref{Any}()
13-
info_observer! = values_observer(; info=info_ref!)
13+
info_observer! = values_observer(; info=(info_ref!))
1414
observer! = compose_observers(observer!, info_observer!)
1515
state = alternating_update(operator, init; updater, observer!, kwargs...)
1616
return info_ref![].eigval, state

src/solvers/alternating_update.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ function alternating_update(
104104
flush(stdout)
105105
end
106106
isdone = checkdone(;
107-
state, sweep, outputlevel, observer=observer!, sweep_observer=sweep_observer!
107+
state, sweep, outputlevel, observer=(observer!), sweep_observer=(sweep_observer!)
108108
)
109109
isdone && break
110110
end

src/solvers/sweep_update.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ function region_update!(
302302
end
303303
set_nsite!(reduced_operator, nsite - 1)
304304
position!(reduced_operator, state, b1)
305-
internal_kwargs = (; current_time, time_step=-time_step, outputlevel)
305+
internal_kwargs = (; current_time, time_step=(-time_step), outputlevel)
306306
bond_reduced_state, info = updater(
307307
reduced_operator, bond_reduced_state; internal_kwargs, updater_kwargs...
308308
)
@@ -437,7 +437,7 @@ function region_update!(
437437
bond_reduced_state = state[b1]
438438
set_nsite!(reduced_operator, nsite - 1)
439439
position!(reduced_operator, state, b1)
440-
internal_kwargs = (; current_time, time_step=-time_step, outputlevel)
440+
internal_kwargs = (; current_time, time_step=(-time_step), outputlevel)
441441
bond_reduced_state, info = updater(
442442
reduced_operator, bond_reduced_state; internal_kwargs, updater_kwargs...
443443
)

src/solvers/tdvp.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function tdvp(
7979
nsweeps=nothing,
8080
nsteps=nsweeps,
8181
(step_observer!)=default_sweep_observer(),
82-
(sweep_observer!)=step_observer!,
82+
(sweep_observer!)=(step_observer!),
8383
kwargs...,
8484
)
8585
time_step, nsteps = time_step_and_nsteps(t, time_step, nsteps)

test/base/test_mpo.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ end
562562
ψ = orthogonalize(ψ0, 2)
563563
A = prod(ITensors.data(ψ)[2:(N - 1)])
564564
randn!(A)
565-
ψ[2:(N - 1), orthocenter=3] = A
565+
ψ[2:(N - 1), orthocenter = 3] = A
566566
@test prod(ψ) ψ[1] * A * ψ[N]
567567
@test maxlinkdim(ψ) == 4
568568
@test ITensorMPS.orthocenter(ψ) == 3
@@ -728,7 +728,7 @@ end
728728
s = siteinds(H2; plev=1)
729729
C = combiner.(s; tags="X")
730730
H2 .*= C
731-
H2H2 = prime(H2; tags=!ts"X") * dag(H2)
731+
H2H2 = prime(H2; tags=(!ts"X")) * dag(H2)
732732
@test @disable_warn_order prod(HH) prod(H2H2)
733733
end
734734

test/base/test_mps.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1334,7 +1334,7 @@ end
13341334
ψ = orthogonalize(ψ0, 2)
13351335
A = prod(ITensorMPS.data(ψ)[2:(N - 1)])
13361336
randn!(A)
1337-
ψ[2:(N - 1), orthocenter=3] = A
1337+
ψ[2:(N - 1), orthocenter = 3] = A
13381338
@test prod(ψ) ψ[1] * A * ψ[N]
13391339
@test maxlinkdim(ψ) == 4
13401340
@test ITensorMPS.orthocenter(ψ) == 3

0 commit comments

Comments
 (0)