Skip to content

using KrylovKit.exponentiate with ITensors  #116

@orialb

Description

@orialb

Hi,

As a continuation of the discussion in #98 regarding using KrylovKit, I just wanted to update that I implemented TDVP using ITensors + KrylovKit.exponentiate (here ) and it seems to work nicely.

It works almost smoothly out of the box, the only thing missing is implementation of similar(A::ITensor, T) when T is a different type than the storage type of A (to create a similar ComplexF64 ITensor from a Float64 ITensor ). In the meantime I just make sure the MPS is complex before starting time-evolution.

I did some benchmarks vs. the recently added applyExp function in the C++ version of ITensor, and as far as I can tell exponentiate is actually significantly faster.
Using the Julia code below and the C++ code given here, I get:

  • ITensors.jl + KrylovKit - 22.2ms
  • ITensor C++ - 32ms

Both ITensor and Julia (v1.2) were compiled with MKL, and I used 1 MKL thread.
I wouldn't expect to see such a big difference between the implementations, so I hope I benchmarked it correctly (otherwise maybe there is some problem in applyExp).

(Note that I also compared my actual TDVP code vs. the code from ITensor/tdvp branch and also there I see a similar performance advantage to Julia)

p.s - Just wanted to add that in general it was super easy to implement TDVP with ITensors.jl, it took me something like 20 mins to write. So, great job with ITensors.jl and also great job by @Jutho with KrylovKit!

using ITensors, BenchmarkTools, KrylovKit

struct LocalOp
    A::ITensor
    B::ITensor
end

(L::LocalOp)(t::ITensor) = noprime(L.A*t*L.B)

m=100
i,j = Index(m,"i"), Index(m,"j")
v = randomITensor(i,j)
A= randomITensor(i',i)
B = randomITensor(j,j')
M =LocalOp(A/norm(A),B/norm(B) )

@btime exponentiate($M,0.1,$v,tol=1e-12)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions