Using ITensor with Big data types

Hello

I am trying to use ITensor with BigFloats but ran into trouble.
My understanding is that QR, SVD BLAS decomposition do not support Big data types.
Is there a simple workaround for this?
Thanks,
Ron

1 Like

You can try GitHub - JuliaLinearAlgebra/GenericLinearAlgebra.jl: Generic numerical linear algebra in Julia.

Thanks Matt. I added GenericLinearAlgebra.jl and verified that I can do, for example, qr decomposition of a BigFloat ITensor successfully.
However, something still goes wrong internally in ITensor, for example, when calling orthognalize! (after getting to the qr step) or even simply randomMPS(BigFloat,sites).

A minimal example that fails ( ERROR: UndefRefError: access to undefined reference)

using GenericLinearAlgebra
using ITensors

sites = siteinds(“S=1/2”,20)
psi = randomMPS(BigFloat,sites)

I’m sure there isn’t some fundamental reason why we couldn’t get this to work, I think we would just have to work through whatever errors come up. I think @kmp5 may have looked into this a bit.

1 Like

We’re currently in the middle of a big rewrite of the NDTensors.jl backend library which implements the tensor operations used by ITensors.jl, it’s meant to be better organized and designed in general and handle generic code like different GPU and element type backends better than the current NDTensors.jl library. Perhaps some of this will “just work” when that rewrite is done. Additionally, it could just be an issue with GenericLinearAlgebra.

HI all,

I looked into this issue and I actually think its related to how similar is defined for Vector{BigFloat}. What I find in the randomMPS call is that in a vector is found with the value #undef in it during a tensor contraction. This value is created when the output tensor is constructed using the similar function. One can replicate the issue if you create a random vector with BigFloat and call similar

julia> v = rand(BigFloat, 2)
2-element Vector{BigFloat}:
 0.7932223068084634055126420356515827642032940092454878995803670700823602621985869
 0.3994045593624575179130005256984561161320862778997074592614683047941870161467713

julia> similar(v)
2-element Vector{BigFloat}:
 #undef
 #undef

This is different from the other element types which fill the vector with instances of the eltype, for example

julia> vf = rand(Float32, 2)
2-element Vector{Float32}:
 0.17679101
 0.78237075

julia> similar(vf)
2-element Vector{Float32}:
 2.0111734f-30
 1.0f-45

Thanks for looking into it.
Is there any reason why replacing similar by, say, zero would not work?