Skip to content

Commit

Permalink
More specific wrappers for ITensorTDVP interface
Browse files Browse the repository at this point in the history
  • Loading branch information
emstoudenmire committed Apr 1, 2024
1 parent 9358bf3 commit 58ef5d7
Showing 1 changed file with 30 additions and 8 deletions.
38 changes: 30 additions & 8 deletions src/ITensorTDVP.jl
Original file line number Diff line number Diff line change
@@ -1,22 +1,44 @@
module ITensorTDVP

using ITensors: ITensors, MPO
using ITensors: ITensors, MPO, MPS

This comment has been minimized.

Copy link
@mtfishman

mtfishman Apr 1, 2024

Member

MPO and MPS should be loaded from ITensors.ITensorMPS.

using ITensors.NDTensors: @Algorithm_str
using ITensors.ITensorMPS: ITensorMPS
using KrylovKit: KrylovKit

tdvp(args...; kwargs...) = ITensorMPS.itensortdvp_tdvp(args...; kwargs...)
function tdvp(H_generic, t::Number, psi0::MPS; kwargs...)
return ITensorMPS.itensortdvp_tdvp(H_generic, t, psi0; kwargs...)
end
function tdvp(t::Number, H_generic, psi0::MPS; kwargs...)
return ITensorMPS.itensortdvp_tdvp(t, H_generic, psi0; kwargs...)
end
function tdvp(H_generic, psi0::MPS, t::Number; kwargs...)
return ITensorMPS.itensortdvp_tdvp(H_generic, psi0, t; kwargs...)
end
function tdvp(solver, H::MPO, t::Number, psi0::MPS; kwargs...)
return ITensorMPS.itensortdvp_tdvp(solver, H, t, psi0; kwargs...)
end
function tdvp(solver, t::Number, H::MPO, psi0::MPS; kwargs...)
return ITensorMPS.itensortdvp_tdvp(solver, t, H, psi0; kwargs...)
end
function tdvp(solver, psi0::MPS, t::Number, H::MPO; kwargs...)
return ITensorMPS.itensortdvp_tdvp(solver, psi0, t, H; kwargs...)
end
function tdvp(solver, Hs::Vector{MPO}, t::Number, psi0::MPS; kwargs...)
return ITensorMPS.itensortdvp_tdvp(solver, Hs, t, psi0; kwargs...)
end

function KrylovKit.linsolve(A::MPO, args...; kwargs...)
return ITensorMPS.itensortdvp_linsolve(A, args...; kwargs...)
function KrylovKit.linsolve(
A::MPO, b::MPS, x0::MPS, a0::Number=false, a1::Number=true; kwargs...
)
return ITensorMPS.itensortdvp_linsolve(A, b, x0, a0, a1; kwargs...)
end

dmrg(args...; kwargs...) = ITensorMPS.itensortdvp_dmrg(args...; kwargs...)
dmrg(H, psi0::MPS; kwargs...) = ITensorMPS.itensortdvp_dmrg(H, psi0; kwargs...)

dmrg_x(args...; kwargs...) = ITensorMPS.itensortdvp_dmrg_x(args...; kwargs...)
dmrg_x(H, psi0::MPS; kwargs...) = ITensorMPS.itensortdvp_dmrg_x(H, psi0; kwargs...)

function ITensors.contract(alg::Algorithm"fit", args...; kwargs...)
return ITensorMPS.itensortdvp_contract(alg, args...; kwargs...)
function ITensors.contract(alg::Algorithm"fit", A::MPO, psi::MPS; kwargs...)
return ITensorMPS.itensortdvp_contract(alg, A, psi; kwargs...)
end

include("solver_utils.jl")
Expand Down

0 comments on commit 58ef5d7

Please sign in to comment.