tdvp time developing

Hey all!
Can someone explain me we I can’t use tdvp method on the randomMPS function ?

If you are including code in your question or comment, please put it in a code block as follows:

using ITensors
ψ= randomMPS(site)
ψ= tdvp(H,ψ,-1.0*δβ)

Does some know what is the problem ?
The error is:

InexactError: Float64(1.1312004476239226 + 1.3877787807814457e-16im)

You can use TDVP on a random MPS, so the error must be coming from somewhere else. Could you provide more context? What is the full stack trace of the error message?

yes sure,
This is the error I got

ERROR: InexactError: Float64(1.1312004476239226 + 1.3877787807814457e-16im)
Stacktrace:
[1] Real
@ ./complex.jl:44 [inlined]
[2] convert
@ ./number.jl:7 [inlined]
[3] setindex!(::Matrix{Float64}, ::ComplexF64, ::Int64, ::Int64)
@ Base ./array.jl:905
[4] applyexp(H::ProjMPO, tau::Float64, x0::ITensor; kwargs::Base.Pairs{Symbol, Real, NTuple{4, Symbol}, NamedTuple{(:tol, :maxiter, :outputlevel, :current_time), Tuple{Float64, Int64, Int64, Float64}}})
@ ITensorTDVP ~/.julia/packages/ITensorTDVP/H26Xf/src/applyexp.jl:53
[5] (::ITensorTDVP.var"#solver#38"{ITensorTDVP.var"#solver#37#39"{Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}})(H::ProjMPO, t::Float64, psi0::ITensor; kws::Base.Pairs{Symbol, Real, Tuple{Symbol, Symbol}, NamedTuple{(:current_time, :outputlevel), Tuple{Float64, Int64}}})
@ ITensorTDVP ~/.julia/packages/ITensorTDVP/H26Xf/src/tdvp.jl:27
[6] tdvp_site_update!(nsite_val::Val{2}, reverse_step_val::Val{true}, solver::ITensorTDVP.var"#solver#38"{ITensorTDVP.var"#solver#37#39"{Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}}, PH::ProjMPO, psi::MPS, b::Int64; current_time::Float64, outputlevel::Int64, time_step::Float64, normalize::Bool, direction::Base.Order.ForwardOrdering, noise::Float64, which_decomp::Nothing, svd_alg::String, cutoff::Float64, maxdim::Int64, mindim::Int64, maxtruncerr::Float64)
@ ITensorTDVP ~/.julia/packages/ITensorTDVP/H26Xf/src/tdvp_step.jl:353
[7] tdvp_site_update!(solver::ITensorTDVP.var"#solver#38"{ITensorTDVP.var"#solver#37#39"{Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}}, PH::ProjMPO, psi::MPS, b::Int64; nsite::Int64, reverse_step::Bool, current_time::Float64, outputlevel::Int64, time_step::Float64, normalize::Bool, direction::Base.Order.ForwardOrdering, noise::Float64, which_decomp::Nothing, svd_alg::String, cutoff::Float64, maxdim::Int64, mindim::Int64, maxtruncerr::Float64)
@ ITensorTDVP ~/.julia/packages/ITensorTDVP/H26Xf/src/tdvp_step.jl:154
[8] tdvp_sweep(direction::Base.Order.ForwardOrdering, solver::Function, PH::ProjMPO, time_step::Float64, psi::MPS; kwargs::Base.Pairs{Symbol, Real, NTuple{7, Symbol}, NamedTuple{(:current_time, :reverse_step, :sweep, :maxdim, :mindim, :cutoff, :noise), Tuple{Float64, Bool, Int64, Int64, Int64, Float64, Float64}}})
@ ITensorTDVP ~/.julia/packages/ITensorTDVP/H26Xf/src/tdvp_step.jl:78
[9] tdvp_step(order::ITensorTDVP.TDVPOrder{2, Base.Order.ForwardOrdering()}, solver::Function, PH::ProjMPO, time_step::Float64, psi::MPS; current_time::Float64, kwargs::Base.Pairs{Symbol, Real, NTuple{6, Symbol}, NamedTuple{(:reverse_step, :sweep, :maxdim, :mindim, :cutoff, :noise), Tuple{Bool, Int64, Int64, Int64, Float64, Float64}}})
@ ITensorTDVP ~/.julia/packages/ITensorTDVP/H26Xf/src/tdvp_step.jl:9
[10] macro expansion
@ ~/.julia/packages/ITensorTDVP/H26Xf/src/tdvp_generic.jl:82 [inlined]
[11] macro expansion
@ ./timing.jl:299 [inlined]
[12] tdvp(solver::Function, PH::ProjMPO, t::Float64, psi0::MPS; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ ITensorTDVP ~/.julia/packages/ITensorTDVP/H26Xf/src/tdvp_generic.jl:81
[13] tdvp
@ ~/.julia/packages/ITensorTDVP/H26Xf/src/tdvp_generic.jl:44 [inlined]
[14] tdvp(solver::Function, H::MPO, t::Float64, psi0::MPS; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ ITensorTDVP ~/.julia/packages/ITensorTDVP/H26Xf/src/tdvp_generic.jl:148
[15] tdvp
@ ~/.julia/packages/ITensorTDVP/H26Xf/src/tdvp_generic.jl:142 [inlined]
[16] tdvp(H::MPO, t::Float64, psi0::MPS; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ ITensorTDVP ~/.julia/packages/ITensorTDVP/H26Xf/src/tdvp.jl:47
[17] tdvp
@ ~/.julia/packages/ITensorTDVP/H26Xf/src/tdvp.jl:47 [inlined]
[18] #tdvp#43
@ ~/.julia/packages/ITensorTDVP/H26Xf/src/tdvp.jl:55 [inlined]
[19] tdvp(H::MPO, psi0::MPS, t::Float64)
@ ITensorTDVP ~/.julia/packages/ITensorTDVP/H26Xf/src/tdvp.jl:55
[20] top-level scope
@ REPL[9]:1

I don’t know whether this is already solved as I am too late in this thread.
Inexact error generally arise when you are trying to do a type conversion that may require truncation.Here you are trying to convert a complex number to float. In Julia, the complex floats belong to a different data type ComplexF64. From the stacktrace,it seems like the applyexp function is getting Complex value where it expects real float.Does it only appear if you have a random initial state?
Do you get this error for both real and imaginary time evolution?

Thanks for replying @sandipanmanna. I think this is a bug with the “applyexp” solver along the lines you are saying.

@tsegev: as a workaround for now, please try passing the following keyword argument into tdvp which is tdvp(...; solver_backend="exponentiate", ...)

The "exponentiate" solver ought to not have the same bug, and I think we will be switching to it as the default in the future anyway.