Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/FormatPullRequest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: "Format Pull Request"

on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
permissions:
contents: write
pull-requests: write

jobs:
format-pull-request:
name: "Format Pull Request"
uses: "ITensor/ITensorActions/.github/workflows/FormatPullRequest.yml@main"
7 changes: 5 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
ci:
skip: [julia-formatter]

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: check-merge-conflict
- id: check-toml
Expand All @@ -9,6 +12,6 @@ repos:
exclude_types: [markdown] # incompatible with Literate.jl

- repo: "https://github.com/domluna/JuliaFormatter.jl"
rev: v1.0.62
rev: v2.1.0
hooks:
- id: "julia-formatter"
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ITensorMPS"
uuid = "0d1a4710-d33b-49a5-8f18-73bdf49b47e2"
authors = ["Matthew Fishman <[email protected]>", "Miles Stoudenmire <[email protected]>"]
version = "0.3.16"
version = "0.3.17"

[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
Expand Down
6 changes: 3 additions & 3 deletions src/abstractmps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@
# TODO: change kwarg from `set_limits` to `preserve_ortho`
function map!(f::Function, M::AbstractMPS; set_limits::Bool=true)
for i in eachindex(M)
M[i, set_limits=set_limits] = f(M[i])
M[i, set_limits = set_limits] = f(M[i])
end
return M
end
Expand Down Expand Up @@ -1306,7 +1306,7 @@
See also [`normalize!`](@ref), [`norm`](@ref), [`lognorm`](@ref).
"""
function normalize(M::AbstractMPS; (lognorm!)=[])
return normalize!(deepcopy_ortho_center(M); (lognorm!)=lognorm!)
return normalize!(deepcopy_ortho_center(M); (lognorm!)=(lognorm!))

Check warning on line 1309 in src/abstractmps.jl

View check run for this annotation

Codecov / codecov/patch

src/abstractmps.jl#L1309

Added line #L1309 was not covered by tests
end

"""
Expand Down Expand Up @@ -2001,7 +2001,7 @@
elseif rightlim(ψ) > b + 2
ψ = orthogonalize(ψ, b + 1)
end
ψ[b:(b + 1), orthocenter=orthocenter, perm=[2, 1], kwargs...] = ψ[b] * ψ[b + 1]
ψ[b:(b + 1), orthocenter = orthocenter, perm = [2, 1], kwargs...] = ψ[b] * ψ[b + 1]

Check warning on line 2004 in src/abstractmps.jl

View check run for this annotation

Codecov / codecov/patch

src/abstractmps.jl#L2004

Added line #L2004 was not covered by tests
return ψ
end

Expand Down
2 changes: 1 addition & 1 deletion src/lib/Experimental/src/dmrg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
operator, init::MPS; updater=eigsolve_updater, (observer!)=default_observer(), kwargs...
)
info_ref! = Ref{Any}()
info_observer! = values_observer(; info=info_ref!)
info_observer! = values_observer(; info=(info_ref!))

Check warning on line 13 in src/lib/Experimental/src/dmrg.jl

View check run for this annotation

Codecov / codecov/patch

src/lib/Experimental/src/dmrg.jl#L13

Added line #L13 was not covered by tests
observer! = compose_observers(observer!, info_observer!)
state = alternating_update(operator, init; updater, observer!, kwargs...)
return info_ref![].eigval, state
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/alternating_update.jl
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function alternating_update(
flush(stdout)
end
isdone = checkdone(;
state, sweep, outputlevel, observer=observer!, sweep_observer=sweep_observer!
state, sweep, outputlevel, observer=(observer!), sweep_observer=(sweep_observer!)
)
isdone && break
end
Expand Down
4 changes: 2 additions & 2 deletions src/solvers/sweep_update.jl
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@
end
set_nsite!(reduced_operator, nsite - 1)
position!(reduced_operator, state, b1)
internal_kwargs = (; current_time, time_step=-time_step, outputlevel)
internal_kwargs = (; current_time, time_step=(-time_step), outputlevel)

Check warning on line 305 in src/solvers/sweep_update.jl

View check run for this annotation

Codecov / codecov/patch

src/solvers/sweep_update.jl#L305

Added line #L305 was not covered by tests
bond_reduced_state, info = updater(
reduced_operator, bond_reduced_state; internal_kwargs, updater_kwargs...
)
Expand Down Expand Up @@ -437,7 +437,7 @@
bond_reduced_state = state[b1]
set_nsite!(reduced_operator, nsite - 1)
position!(reduced_operator, state, b1)
internal_kwargs = (; current_time, time_step=-time_step, outputlevel)
internal_kwargs = (; current_time, time_step=(-time_step), outputlevel)

Check warning on line 440 in src/solvers/sweep_update.jl

View check run for this annotation

Codecov / codecov/patch

src/solvers/sweep_update.jl#L440

Added line #L440 was not covered by tests
bond_reduced_state, info = updater(
reduced_operator, bond_reduced_state; internal_kwargs, updater_kwargs...
)
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/tdvp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function tdvp(
nsweeps=nothing,
nsteps=nsweeps,
(step_observer!)=default_sweep_observer(),
(sweep_observer!)=step_observer!,
(sweep_observer!)=(step_observer!),
kwargs...,
)
time_step, nsteps = time_step_and_nsteps(t, time_step, nsteps)
Expand Down
4 changes: 2 additions & 2 deletions test/base/test_mpo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ end
ψ = orthogonalize(ψ0, 2)
A = prod(ITensors.data(ψ)[2:(N - 1)])
randn!(A)
ψ[2:(N - 1), orthocenter=3] = A
ψ[2:(N - 1), orthocenter = 3] = A
@test prod(ψ) ψ[1] * A * ψ[N]
@test maxlinkdim(ψ) == 4
@test ITensorMPS.orthocenter(ψ) == 3
Expand Down Expand Up @@ -728,7 +728,7 @@ end
s = siteinds(H2; plev=1)
C = combiner.(s; tags="X")
H2 .*= C
H2H2 = prime(H2; tags=!ts"X") * dag(H2)
H2H2 = prime(H2; tags=(!ts"X")) * dag(H2)
@test @disable_warn_order prod(HH) prod(H2H2)
end

Expand Down
2 changes: 1 addition & 1 deletion test/base/test_mps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1334,7 +1334,7 @@ end
ψ = orthogonalize(ψ0, 2)
A = prod(ITensorMPS.data(ψ)[2:(N - 1)])
randn!(A)
ψ[2:(N - 1), orthocenter=3] = A
ψ[2:(N - 1), orthocenter = 3] = A
@test prod(ψ) ψ[1] * A * ψ[N]
@test maxlinkdim(ψ) == 4
@test ITensorMPS.orthocenter(ψ) == 3
Expand Down
1 change: 1 addition & 0 deletions test/base/test_qnmpo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ test_combos = [(make_heisenberg_opsum, "S=1/2"), (make_hubbard_opsum, "Electron"

@testset "QR/QL MPO tensors with complex block structures, H=$(test_combo[1])" for test_combo in
test_combos

N, NNN = 10, 7 #10 lattice site, up 7th neight interactions
sites = siteinds(test_combo[2], N; conserve_qns=true)
H = test_combo[1](sites, NNN)
Expand Down
2 changes: 1 addition & 1 deletion test/base/test_solvers/test_tdvp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const elts = (Float32, Float64, Complex{Float32}, Complex{Float64})
total_time = elt(0.1) * im
# matching total time and time step directions
@test_throws "signs agree" tdvp(H, -total_time, ψ0; time_step)
@test_throws "signs agree" tdvp(H, total_time, ψ0; time_step=-time_step)
@test_throws "signs agree" tdvp(H, total_time, ψ0; time_step=(-time_step))
# total time is an integer of time steps
@test_throws "integer" tdvp(H, total_time * 1.5, ψ0; time_step)
end
Expand Down
2 changes: 1 addition & 1 deletion test/ext/ITensorMPSChainRulesCoreExt/test_optimization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ include(joinpath(@__DIR__, "utils", "circuit.jl"))
end

@testset "State preparation (MPS)" begin
for gate in ["Ry"] #="Rx", =#
for gate in ["Ry"]
nsites = 4 # Number of sites
nlayers = 2 # Layers of gates in the ansatz
gradtol = 1e-3 # Tolerance for stopping gradient descent
Expand Down
Loading