Skip to content

[BUG] cutoff=nothing and cutoff=0.0 appear to give different results #136

@NuclearPowerNerd

Description

@NuclearPowerNerd

Hello,

The default cutoff appears to be nothing in many algorithms in ITensors. I may have naively thought this meant the same thing as cutoff=0.0 but that doesn't appear to be the case.

I'm trying to determine if this is expected behavior and it is just my thinking that is wrong. Please correct me if so. Below is an MWE that demonstrates the apparent "bug". Specifically, that cutoff=nothing appears to give a different result than cutoff=0.0.

I would have guessed that err1 is the same as err2. I put what I am getting on my PC.

Is there an explanation for this difference? Or a specific place within the ITensor library I could look to try to understand why there is a difference here? My intution would have been that somewhere there is a check that says if !isnothing(cutoff) || cutoff > 0.0 then ... and then truncation happens.

begin
    d = 2
    N = 10
    n = d^N
    v = rand(n)
    sinds = siteinds(d, N)
    V = MPS(v, sinds)
    X = MPS(v, sinds, cutoff=0.0)
    Y = MPS(v, sinds, cutoff=nothing)
end
infidelity(a, b) = 1.0 - dot(a, b)^2 / (norm(a)^2 * norm(b)^2)

err1 = infidelity(V, X) # -1.1102230246251565e-15
err2 = infidelity(V, Y) # 6.661338147750939e-16

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions