Skip to content

Contraction error after v0.14.7 #255

@Qiaoyi-Li

Description

@Qiaoyi-Li

Hi Jutho and Lukas,

I use TensorKit.jl to handle non-Abelian symmetries in my MPS package. After updating TensorKit to version 0.14.7, some tensor contraction processes that previously worked now return errors. The following is an instance to reproduce the issue:

using TensorKit

pspace = Rep[U₁×SU₂]((-1, 0) => 1, (0, 1 / 2) => 1)
aspace = Rep[U₁×SU₂]((1, 1 / 2) => 1)

A = ones(pspace , pspace  aspace)
B = isometry(aspace, flip(aspace))
@tensor C[a; c d] := A'[a b c] * B'[d b]

The error message:

ERROR: TypeError: in typeassert, expected Int64, got a value of type Nothing
Stacktrace:
  [1] TensorKit.GenericTreeTransformer(transform::TensorKit.var"#fusiontreetransform#238"{}, p::Tuple{…}, Vdst::TensorMapSpace{…}, Vsrc::TensorMapSpace{…})
    @ TensorKit ~/.julia/packages/TensorKit/fQn8E/src/tensors/treetransformers.jl:92
  [2] TensorKit.TreeTransformer(transform::Function, p::Tuple{…}, Vdst::TensorMapSpace{…}, Vsrc::TensorMapSpace{…})
    @ TensorKit ~/.julia/packages/TensorKit/fQn8E/src/tensors/treetransformers.jl:157
  [3] _treepermuter
    @ ~/.julia/packages/TensorKit/fQn8E/src/tensors/treetransformers.jl:187 [inlined]
  [4] #236
    @ ~/.julia/packages/TensorKit/fQn8E/src/auxiliary/caches.jl:108 [inlined]
  [5] get!(default::TensorKit.var"#236#241"{}, lru::LRUCache.LRU{…}, key::Tuple{…})
    @ LRUCache ~/.julia/packages/LRUCache/ZH7qB/src/LRUCache.jl:169
  [6] treepermuter(Vdst::TensorMapSpace{…}, Vsrc::TensorMapSpace{…}, p::Tuple{…}, ::TensorKit.GlobalLRUCache)
    @ TensorKit ./none:0
  [7] treepermuter
    @ ./none:0 [inlined]
  [8] treepermuter
    @ ~/.julia/packages/TensorKit/fQn8E/src/tensors/treetransformers.jl:182 [inlined]
  [9] add_permute!
    @ ~/.julia/packages/TensorKit/fQn8E/src/tensors/indexmanipulations.jl:405 [inlined]
 [10] permute!
    @ ~/.julia/packages/TensorKit/fQn8E/src/tensors/indexmanipulations.jl:38 [inlined]
 [11] permute(t::TensorMap{Float64, GradedSpace{…}, 1, 2, Vector{…}}, ::Tuple{Tuple{…}, Tuple{…}}; copy::Bool)
    @ TensorKit ~/.julia/packages/TensorKit/fQn8E/src/tensors/indexmanipulations.jl:77
 [12] permute
    @ ~/.julia/packages/TensorKit/fQn8E/src/tensors/indexmanipulations.jl:65 [inlined]
 [13] #permute#254
    @ ~/.julia/packages/TensorKit/fQn8E/src/tensors/indexmanipulations.jl:83 [inlined]
 [14] permute
    @ ~/.julia/packages/TensorKit/fQn8E/src/tensors/indexmanipulations.jl:80 [inlined]
 [15] _contract!::VectorInterface.One, A::TensorKit.AdjointTensorMap{…}, B::TensorKit.AdjointTensorMap{…}, β::VectorInterface.Zero, C::TensorMap{…}, oindA::Tuple{…}, cindA::Tuple{…}, oindB::Tuple{…}, cindB::Tuple{…}, p₁::Tuple{…}, p₂::Tuple{…})
    @ TensorKit ~/.julia/packages/TensorKit/fQn8E/src/tensors/tensoroperations.jl:312
 [16] contract!(C::TensorMap{…}, A::TensorKit.AdjointTensorMap{…}, ::Tuple{…}, B::TensorKit.AdjointTensorMap{…}, ::Tuple{…}, ::Tuple{…}, α::VectorInterface.One, β::VectorInterface.Zero, backend::TensorOperations.DefaultBackend, allocator::TensorOperations.DefaultAllocator)
    @ TensorKit ~/.julia/packages/TensorKit/fQn8E/src/tensors/tensoroperations.jl:286
 [17] tensorcontract!
    @ ~/.julia/packages/TensorKit/fQn8E/src/tensors/tensoroperations.jl:107 [inlined]
 [18] tensorcontract!
    @ ~/.julia/packages/TensorOperations/jVddt/src/interface.jl:148 [inlined]
 [19] tensorcontract!(C::TensorMap{…}, A::TensorKit.AdjointTensorMap{…}, pA::Tuple{…}, conjA::Bool, B::TensorKit.AdjointTensorMap{…}, pB::Tuple{…}, conjB::Bool, pAB::Tuple{…}, α::VectorInterface.One, β::VectorInterface.Zero)
    @ TensorOperations ~/.julia/packages/TensorOperations/jVddt/src/interface.jl:139

Is this error from a potential bug introduced in the recent update of TensorKit?

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