diff --git a/src/MPSKit.jl b/src/MPSKit.jl index 8c4445f5..18232bdc 100644 --- a/src/MPSKit.jl +++ b/src/MPSKit.jl @@ -27,7 +27,9 @@ export entanglementplot, transferplot # hamiltonian things export Cache -export SparseMPO, MPOHamiltonian, DenseMPO, MPOMultiline, UntimedOperator, TimedOperator, LazySum +export SparseMPO, MPOHamiltonian, DenseMPO, MPOMultiline +export UntimedOperator, TimedOperator, LazySum + export ∂C, ∂AC, ∂AC2, environments, expectation_value, effective_excitation_hamiltonian export leftenv, rightenv diff --git a/src/algorithms/derivatives.jl b/src/algorithms/derivatives.jl index 06957f95..f642965c 100644 --- a/src/algorithms/derivatives.jl +++ b/src/algorithms/derivatives.jl @@ -280,13 +280,20 @@ function ∂∂AC2(pos::Int, state, opp::ProjectionOperator, env) rightenv(env, pos + 1, state)) end - # time dependent derivate operators (h::UntimedOperator{<:DerivativeOperator})(y, args...) = h.f * h.op(y) (h::TimedOperator{<:DerivativeOperator})(y, t::Number) = h.f(t) * h.op(y) -(x::LazySum{<:Union{MultipliedOperator{D}, D} where {D<:DerivativeOperator}})(y, t::Number) = sum(O -> O(y,t), x) -(x::LazySum{<:Union{MultipliedOperator{D}, D} where {D<:DerivativeOperator}})(y) = sum(O -> O(y), x) -Base.:*(h::LazySum{<:Union{D,MultipliedOperator{D}} where {D<:DerivativeOperator}}, v) = h(v) +function (x::LazySum{<:Union{MultipliedOperator{D},D} where {D<:DerivativeOperator}})(y, + t::Number) + return sum(O -> O(y, t), x) +end +function (x::LazySum{<:Union{MultipliedOperator{D},D} where {D<:DerivativeOperator}})(y) + return sum(O -> O(y), x) +end +function Base.:*(h::LazySum{<:Union{D,MultipliedOperator{D}} where {D<:DerivativeOperator}}, + v) + return h(v) +end function ∂∂C(pos::Int, mps, opp::MultipliedOperator, cache) return MultipliedOperator(∂∂C(pos::Int, mps, opp.op, cache), opp.f) @@ -301,16 +308,16 @@ function ∂∂AC2(pos::Int, mps, opp::MultipliedOperator, cache) end function ∂∂C(pos::Int, mps, opp::LazySum, cache::MultipleEnvironments) - return LazySum{Union{MPO_∂∂C,MultipliedOperator{<:MPO_∂∂C}}}(map((op, openv) -> ∂∂C(pos, mps, op, openv), opp.ops, - cache.envs)) + suboperators = map((op, openv) -> ∂∂C(pos, mps, op, openv), opp.ops, cache.envs) + return LazySum{Union{MPO_∂∂C,MultipliedOperator{<:MPO_∂∂C}}}(suboperators) end function ∂∂AC(pos::Int, mps, opp::LazySum, cache::MultipleEnvironments) - return LazySum{Union{MPO_∂∂AC,MultipliedOperator{<:MPO_∂∂AC}}}(map((op, openv) -> ∂∂AC(pos, mps, op, openv), opp.ops, - cache.envs)) + suboperators = map((op, openv) -> ∂∂AC(pos, mps, op, openv), opp.ops, cache.envs) + return LazySum{Union{MPO_∂∂AC,MultipliedOperator{<:MPO_∂∂AC}}}(suboperators) end function ∂∂AC2(pos::Int, mps, opp::LazySum, cache::MultipleEnvironments) - return LazySum{Union{MPO_∂∂AC2,MultipliedOperator{<:MPO_∂∂AC2}}}(map((op, openv) -> ∂∂AC2(pos, mps, op, openv), opp.ops, - cache.envs)) + suboperators = map((op, openv) -> ∂∂AC2(pos, mps, op, openv), opp.ops, cache.envs) + return LazySum{Union{MPO_∂∂AC2,MultipliedOperator{<:MPO_∂∂AC2}}}(suboperators) end diff --git a/src/algorithms/timestep/integrators.jl b/src/algorithms/timestep/integrators.jl index cddaa09c..8b693477 100644 --- a/src/algorithms/timestep/integrators.jl +++ b/src/algorithms/timestep/integrators.jl @@ -15,10 +15,10 @@ function integrate end # default for things that are callable on two arguments _eval_t(f, t::Number) = Base.Fix2(f, t) -_eval_x(f, x) = Base.Fix1(f, x) +_eval_x(f, x) = Base.Fix1(f, x) function integrate(f, y₀, t::Number, dt::Number, alg::Union{Arnoldi,Lanczos}) - y, convhist = exponentiate(_eval_t(f, t), -1im*dt, y₀, alg) + y, convhist = exponentiate(_eval_t(f, t), -1im * dt, y₀, alg) convhist.converged == 0 && @warn "integration failed $(convhist.normres)" return y end diff --git a/src/algorithms/timestep/tdvp.jl b/src/algorithms/timestep/tdvp.jl index 2f1593d1..57c2bd48 100644 --- a/src/algorithms/timestep/tdvp.jl +++ b/src/algorithms/timestep/tdvp.jl @@ -18,15 +18,9 @@ algorithm for time evolution. finalize::F = Defaults._finalize end -function timestep( - Ψ::InfiniteMPS, - H, - t::Number, - dt::Number, - alg::TDVP, - envs::Union{Cache,MultipleEnvironments}=environments(Ψ, H); - leftorthflag=true, -) +function timestep(Ψ::InfiniteMPS, H, t::Number, dt::Number, alg::TDVP, + envs::Union{Cache,MultipleEnvironments}=environments(Ψ, H); + leftorthflag=true) temp_ACs = similar(Ψ.AC) temp_CRs = similar(Ψ.CR) @sync for (loc, (ac, c)) in enumerate(zip(Ψ.AC, Ψ.CR)) @@ -64,14 +58,8 @@ function timestep( return newΨ, envs end -function timestep!( - Ψ::AbstractFiniteMPS, - H, - t::Number, - dt::Number, - alg::TDVP, - envs::Union{Cache,MultipleEnvironments}=environments(Ψ, H), -) +function timestep!(Ψ::AbstractFiniteMPS, H, t::Number, dt::Number, alg::TDVP, + envs::Union{Cache,MultipleEnvironments}=environments(Ψ, H)) # sweep left to right for i in 1:(length(Ψ) - 1) @@ -124,9 +112,8 @@ algorithm for time evolution. finalize::F = Defaults._finalize end -function timestep!( - Ψ::AbstractFiniteMPS, H, t::Number, dt::Number, alg::TDVP2, envs=environments(Ψ, H) -) +function timestep!(Ψ::AbstractFiniteMPS, H, t::Number, dt::Number, alg::TDVP2, + envs=environments(Ψ, H)) # sweep left to right for i in 1:(length(Ψ) - 1) @@ -139,9 +126,8 @@ function timestep!( Ψ.AC[i + 1] = (complex(nc), _transpose_front(nar)) if i != (length(Ψ) - 1) - Ψ.AC[i + 1] = integrate( - ∂∂AC(i + 1, Ψ, H, envs), Ψ.AC[i + 1], t, -dt / 2, alg.integrator - ) + Ψ.AC[i + 1] = integrate(∂∂AC(i + 1, Ψ, H, envs), Ψ.AC[i + 1], t, -dt / 2, + alg.integrator) end end @@ -149,16 +135,15 @@ function timestep!( for i in length(Ψ):-1:2 ac2 = _transpose_front(Ψ.AL[i - 1]) * _transpose_tail(Ψ.AC[i]) h_ac2 = ∂∂AC2(i - 1, Ψ, H, envs) - nac2 = integrate(h_ac2, ac2, t + dt / 2, dt / 2, alg.integrator) + nac2 = integrate(h_ac2, ac2, t + dt / 2, dt / 2, alg.integrator) nal, nc, nar = tsvd!(nac2; trunc=alg.trscheme, alg=TensorKit.SVD()) Ψ.AC[i - 1] = (nal, complex(nc)) Ψ.AC[i] = (complex(nc), _transpose_front(nar)) if i != 2 - Ψ.AC[i - 1] = integrate( - ∂∂AC(i - 1, Ψ, H, envs), Ψ.AC[i - 1], t + dt / 2, -dt / 2, alg.integrator - ) + Ψ.AC[i - 1] = integrate(∂∂AC(i - 1, Ψ, H, envs), Ψ.AC[i - 1], t + dt / 2, + -dt / 2, alg.integrator) end end @@ -166,14 +151,7 @@ function timestep!( end #copying version -function timestep( - Ψ::AbstractFiniteMPS, - H, - time::Number, - timestep::Number, - alg::Union{TDVP,TDVP2}, - envs=environments(Ψ, H); - kwargs..., -) +function timestep(Ψ::AbstractFiniteMPS, H, time::Number, timestep::Number, + alg::Union{TDVP,TDVP2}, envs=environments(Ψ, H); kwargs...) return timestep!(copy(Ψ), H, time, timestep, alg, envs; kwargs...) -end \ No newline at end of file +end diff --git a/src/algorithms/timestep/time_evolve.jl b/src/algorithms/timestep/time_evolve.jl index a2a9672f..4ebdd053 100644 --- a/src/algorithms/timestep/time_evolve.jl +++ b/src/algorithms/timestep/time_evolve.jl @@ -15,9 +15,8 @@ through each of the time points obtained by iterating t_span. function time_evolve end, function time_evolve! end # TODO: is it possible to remove this code-duplication? -function time_evolve( - ψ, H, t_span::AbstractVector{<:Number}, alg, envs=environments(ψ, H); verbose=false -) +function time_evolve(ψ, H, t_span::AbstractVector{<:Number}, alg, envs=environments(ψ, H); + verbose=false) for (t, dt) in zip(t_span[2:end], diff(t_span)) elapsed = @elapsed ψ, envs = timestep(ψ, H, t, dt, alg, envs) verbose && @info "Timestep iteration:" t elapsed @@ -25,9 +24,8 @@ function time_evolve( end return ψ, envs end -function time_evolve!( - ψ, H, t_span::AbstractVector{<:Number}, alg, envs=environments(ψ, H); verbose=false -) +function time_evolve!(ψ, H, t_span::AbstractVector{<:Number}, alg, envs=environments(ψ, H); + verbose=false) for (t, dt) in zip(t_span[2:end], diff(t_span)) elapsed = @elapsed ψ, envs = timestep!(ψ, H, t, dt, alg, envs) verbose && @info "Timestep iteration:" t elapsed diff --git a/src/operators/lazysum.jl b/src/operators/lazysum.jl index ef62d8dc..5d911cbf 100644 --- a/src/operators/lazysum.jl +++ b/src/operators/lazysum.jl @@ -44,7 +44,7 @@ end # For users # using (t) should return NotTimeDependent LazySum -(x::LazySum)(t::Number) = safe_eval(x, t) +(x::LazySum)(t::Number) = safe_eval(x, t) Base.sum(x::LazySum) = safe_eval(x) #so it works for untimedoperator # we define the addition for LazySum and we do the rest with this @@ -54,6 +54,6 @@ end Base.:+(op1::LazySum, op2) = op1 + LazySum(op2) Base.:+(op1, op2::LazySum) = LazySum(op1) + op2 -Base.:+(op1::MultipliedOperator, op2::MultipliedOperator) = LazySum([op1,op2]) +Base.:+(op1::MultipliedOperator, op2::MultipliedOperator) = LazySum([op1, op2]) Base.repeat(x::LazySum, args...) = LazySum(repeat.(x, args...)) diff --git a/src/operators/multipliedoperator.jl b/src/operators/multipliedoperator.jl index d5b251fa..5efff901 100644 --- a/src/operators/multipliedoperator.jl +++ b/src/operators/multipliedoperator.jl @@ -26,8 +26,8 @@ const UntimedOperator{O} = MultipliedOperator{O,<:Union{Real,One}} TimedOperator(x::O, f::F) where {F<:Function,O} = MultipliedOperator(x, f) UntimedOperator(x::O, c::C) where {C<:Union{Real,One},O} = MultipliedOperator(x, c) -TimedOperator(x) = TimedOperator(x,t->One()) -UntimedOperator(x) = UntimedOperator(x,One()) +TimedOperator(x) = TimedOperator(x, t -> One()) +UntimedOperator(x) = UntimedOperator(x, One()) # Holy traits TimeDependence(x::TimedOperator) = TimeDependent() @@ -35,15 +35,15 @@ TimeDependence(x::TimedOperator) = TimeDependent() # For internal use only _eval_at(x::UntimedOperator) = x.f * x.op _eval_at(x::UntimedOperator, ::Number) = x #_eval_at(x) -_eval_at(x::TimedOperator, t::Number) = UntimedOperator(x.op,x.f(t)) +_eval_at(x::TimedOperator, t::Number) = UntimedOperator(x.op, x.f(t)) # For users -(x::UntimedOperator)() = _eval_at(x) -(x::TimedOperator)(t::Number) = _eval_at(x,t) +(x::UntimedOperator)() = _eval_at(x) +(x::TimedOperator)(t::Number) = _eval_at(x, t) # what to do when we multiply by a scalar Base.:*(op::UntimedOperator, b::Number) = UntimedOperator(op.op, b * op.f) -Base.:*(op::TimedOperator, b::Number) = TimedOperator(op.op, t -> b * op.f(t)) +Base.:*(op::TimedOperator, b::Number) = TimedOperator(op.op, t -> b * op.f(t)) Base.:*(b::Number, op::MultipliedOperator) = op * b Base.:*(op::TimedOperator, g::Function) = TimedOperator(op.op, t -> g(t) * op.f(t)) #slightly dangerous diff --git a/test/algorithms.jl b/test/algorithms.jl index ba1c3cd3..0045cc01 100644 --- a/test/algorithms.jl +++ b/test/algorithms.jl @@ -96,7 +96,7 @@ end E₀ = expectation_value(ψ₀, H) @testset "Finite $(alg isa TDVP ? "TDVP" : "TDVP2")" for alg in algs - ψ, envs = timestep(ψ₀, H, 0., dt, alg) + ψ, envs = timestep(ψ₀, H, 0.0, dt, alg) E = expectation_value(ψ, H, envs) @test sum(E₀) ≈ sum(E) atol = 1e-2 end @@ -104,19 +104,20 @@ end Hlazy = LazySum([3 * H, 1.55 * H, -0.1 * H]) @testset "Finite LazySum $(alg isa TDVP ? "TDVP" : "TDVP2")" for alg in algs - ψ, envs = timestep(ψ₀, Hlazy, 0., dt, alg) + ψ, envs = timestep(ψ₀, Hlazy, 0.0, dt, alg) E = expectation_value(ψ, Hlazy, envs) @test (3 + 1.55 - 0.1) * sum(E₀) ≈ sum(E) atol = 1e-2 end - Ht = TimedOperator(H,t->4) + UntimedOperator(H,1.45) - - @testset "Finite TimeDependent LazySum $(alg isa TDVP ? "TDVP" : "TDVP2")" for alg in algs - ψ, envs = timestep(ψ₀, Ht(1.), 0., dt, alg) - E = expectation_value(ψ, Ht(1.), envs) + Ht = TimedOperator(H, t -> 4) + UntimedOperator(H, 1.45) - ψt, envst = timestep(ψ₀, Ht, 1., dt, alg) - Et = expectation_value(ψt, Ht(1.), envst) + @testset "Finite TimeDependent LazySum $(alg isa TDVP ? "TDVP" : "TDVP2")" for alg in + algs + ψ, envs = timestep(ψ₀, Ht(1.0), 0.0, dt, alg) + E = expectation_value(ψ, Ht(1.0), envs) + + ψt, envst = timestep(ψ₀, Ht, 1.0, dt, alg) + Et = expectation_value(ψt, Ht(1.0), envst) @test sum(E) ≈ sum(Et) atol = 1e-8 end @@ -125,7 +126,7 @@ end E₀ = expectation_value(ψ₀, H) @testset "Infinite TDVP" begin - ψ, envs = timestep(ψ₀, H, 0., dt, TDVP()) + ψ, envs = timestep(ψ₀, H, 0.0, dt, TDVP()) E = expectation_value(ψ, H, envs) @test sum(E₀) ≈ sum(E) atol = 1e-2 end @@ -133,22 +134,21 @@ end Hlazy = LazySum([3 * H, 1.55 * H, -0.1 * H]) @testset "Infinite LazySum TDVP" begin - ψ, envs = timestep(ψ₀, Hlazy, 0., dt, TDVP()) + ψ, envs = timestep(ψ₀, Hlazy, 0.0, dt, TDVP()) E = expectation_value(ψ, Hlazy, envs) @test (3 + 1.55 - 0.1) * sum(E₀) ≈ sum(E) atol = 1e-2 end - Ht = TimedOperator(H,t->4) + UntimedOperator(H,1.45) + Ht = TimedOperator(H, t -> 4) + UntimedOperator(H, 1.45) @testset "Infinite TimeDependent LazySum" begin - ψ, envs = timestep(ψ₀, Ht(1.), 0., dt, TDVP()) - E = expectation_value(ψ, Ht(1.), envs) + ψ, envs = timestep(ψ₀, Ht(1.0), 0.0, dt, TDVP()) + E = expectation_value(ψ, Ht(1.0), envs) - ψt, envst = timestep(ψ₀, Ht, 1., dt, TDVP()) - Et = expectation_value(ψt, Ht(1.), envst) + ψt, envst = timestep(ψ₀, Ht, 1.0, dt, TDVP()) + Et = expectation_value(ψt, Ht(1.0), envst) @test sum(E) ≈ sum(Et) atol = 1e-8 end - end @testset "time_evolve" verbose = true begin @@ -174,8 +174,6 @@ end E = expectation_value(ψ, H, envs) @test sum(E₀) ≈ sum(E) atol = 1e-2 end - - end @testset "leading_boundary" verbose = true begin @@ -448,7 +446,7 @@ end st2, _ = approximate(st, (W2, st), VUMPS(; verbose=false)) st3, _ = approximate(st, (W1, st), IDMRG1(; verbose=false)) st4, _ = approximate(st, (sW2, st), IDMRG2(; trscheme=truncdim(20), verbose=false)) - st5, _ = timestep(st, th, 0., dt, TDVP()) + st5, _ = timestep(st, th, 0.0, dt, TDVP()) st6 = changebonds(W1 * st, SvdCut(; trscheme=truncdim(10))) @test abs(dot(st1, st5)) ≈ 1.0 atol = dt @@ -484,7 +482,7 @@ end expH = make_time_mpo(H, τ, WI()) ψ₂, = approximate(ψ₂, (expH, ψ₁), alg) normalize!(ψ₂) - ψ₂′, = timestep(ψ₁, H, 0., τ, TDVP()) + ψ₂′, = timestep(ψ₁, H, 0.0, τ, TDVP()) @test abs(dot(ψ₁, ψ₁)) ≈ abs(dot(ψ₂, ψ₂′)) atol = 0.001 end diff --git a/test/operators.jl b/test/operators.jl index e452d9b0..18f3267d 100644 --- a/test/operators.jl +++ b/test/operators.jl @@ -91,47 +91,54 @@ end @test sum(LazyOs_added) ≈ 2 * summed atol = 1 - 08 end -@testset "MulitpliedOperator of $(typeof(O)) with $(typeof(f))" for (O,f) in zip((rand(ComplexF64), - TensorMap(rand, ComplexF64, - ℂ^13, ℂ^7), - TensorMap(rand, ComplexF64, - ℂ^1 ⊗ ℂ^2, - ℂ^3 ⊗ ℂ^4), - ),(t->3t,1.1,One())) - - tmp = MPSKit.MultipliedOperator(O,f) +@testset "MulitpliedOperator of $(typeof(O)) with $(typeof(f))" for (O, f) in + zip((rand(ComplexF64), + TensorMap(rand, + ComplexF64, + ℂ^13, + ℂ^7), + TensorMap(rand, + ComplexF64, + ℂ^1 ⊗ + ℂ^2, + ℂ^3 ⊗ + ℂ^4)), + (t -> 3t, 1.1, + One())) + tmp = MPSKit.MultipliedOperator(O, f) if tmp isa TimedOperator - @test tmp(1.1)() ≈ f(1.1)*O atol = 1 - 08 + @test tmp(1.1)() ≈ f(1.1) * O atol = 1 - 08 elseif tmp isa UntimedOperator - @test tmp() ≈ f*O atol = 1 - 08 + @test tmp() ≈ f * O atol = 1 - 08 end end @testset "General Time-dependent LazySum of $(eltype(Os))" for Os in (rand(ComplexF64, 4), - fill(TensorMap(rand, ComplexF64, - ℂ^13, ℂ^7), - 4), - fill(TensorMap(rand, ComplexF64, - ℂ^1 ⊗ ℂ^2, - ℂ^3 ⊗ ℂ^4), - 4)) - - + fill(TensorMap(rand, + ComplexF64, + ℂ^13, ℂ^7), + 4), + fill(TensorMap(rand, + ComplexF64, + ℂ^1 ⊗ ℂ^2, + ℂ^3 ⊗ ℂ^4), + 4)) + #test user interface - fs = [t->3t,t->t+2,4,1] - Ofs = map(zip(fs,Os)) do (f,O) + fs = [t -> 3t, t -> t + 2, 4, 1] + Ofs = map(zip(fs, Os)) do (f, O) if f == 1 return O else - return MPSKit.MultipliedOperator(O,f) + return MPSKit.MultipliedOperator(O, f) end end - LazyOs = LazySum(Ofs) - summed = sum(zip(fs,Os)) do (f,O) + LazyOs = LazySum(Ofs) + summed = sum(zip(fs, Os)) do (f, O) if f isa Function - f(1.1)*O + f(1.1) * O else - f*O + f * O end end @@ -195,24 +202,24 @@ vspaces = (ℙ^10, Rep[U₁]((0 => 20)), Rep[SU₂](1 => 10, 3 => 5, 5 => 1)) sum1 = sum(zip(Hs, Envs)) do (H, env) return MPSKit.∂∂C(1, ψ, H, env)(ψ.CR[1]) end - @test summedhct(ψ.CR[1], 0.) ≈ sum1 + @test summedhct(ψ.CR[1], 0.0) ≈ sum1 summedhct = MPSKit.∂∂AC(1, ψ, summedH, summedEnvs) sum2 = sum(zip(Hs, Envs)) do (H, env) return MPSKit.∂∂AC(1, ψ, H, env)(ψ.AC[1]) end - @test summedhct(ψ.AC[1], 0.) ≈ sum2 + @test summedhct(ψ.AC[1], 0.0) ≈ sum2 v = MPSKit._transpose_front(ψ.AC[1]) * MPSKit._transpose_tail(ψ.AR[2]) summedhct = MPSKit.∂∂AC2(1, ψ, summedH, summedEnvs) sum3 = sum(zip(Hs, Envs)) do (H, env) return MPSKit.∂∂AC2(1, ψ, H, env)(v) end - @test summedhct(v, 0.) ≈ sum3 + @test summedhct(v, 0.0) ≈ sum3 end - fs = [t->3t,2,1] - Hts = [TimedOperator(H1,fs[1]),UntimedOperator(H2,fs[2]),H3] + fs = [t -> 3t, 2, 1] + Hts = [TimedOperator(H1, fs[1]), UntimedOperator(H2, fs[2]), H3] summedH = LazySum(Hts) t = 1.1 summedH_at = summedH(t) @@ -220,13 +227,12 @@ vspaces = (ℙ^10, Rep[U₁]((0 => 20)), Rep[SU₂](1 => 10, 3 => 5, 5 => 1)) @testset "Time-dependent LazySum $(ψ isa FiniteMPS ? "F" : "Inf")initeMPS" for ψ in ψs Envs = map(H -> environments(ψ, H), Hs) summedEnvs = environments(ψ, summedH) - expval = sum(zip(fs, Hs, Envs)) do (f, H, Env) if f isa Function f = f(t) end - f*expectation_value(ψ, H, Env) + return f * expectation_value(ψ, H, Env) end expval1 = expectation_value(ψ, sum(summedH_at)) expval2 = expectation_value(ψ, summedH_at, summedEnvs) @@ -241,7 +247,7 @@ vspaces = (ℙ^10, Rep[U₁]((0 => 20)), Rep[SU₂](1 => 10, 3 => 5, 5 => 1)) if f isa Function f = f(t) end - return f*MPSKit.∂∂C(1, ψ, H, env)(ψ.CR[1]) + return f * MPSKit.∂∂C(1, ψ, H, env)(ψ.CR[1]) end @test summedhct(ψ.CR[1], t) ≈ sum1 @@ -250,7 +256,7 @@ vspaces = (ℙ^10, Rep[U₁]((0 => 20)), Rep[SU₂](1 => 10, 3 => 5, 5 => 1)) if f isa Function f = f(t) end - return f*MPSKit.∂∂AC(1, ψ, H, env)(ψ.AC[1]) + return f * MPSKit.∂∂AC(1, ψ, H, env)(ψ.AC[1]) end @test summedhct(ψ.AC[1], t) ≈ sum2 @@ -260,7 +266,7 @@ vspaces = (ℙ^10, Rep[U₁]((0 => 20)), Rep[SU₂](1 => 10, 3 => 5, 5 => 1)) if f isa Function f = f(t) end - return f*MPSKit.∂∂AC2(1, ψ, H, env)(v) + return f * MPSKit.∂∂AC2(1, ψ, H, env)(v) end @test summedhct(v, t) ≈ sum3 end