diff --git a/Project.toml b/Project.toml index 842510577..cf50d3418 100644 --- a/Project.toml +++ b/Project.toml @@ -41,7 +41,7 @@ Printf = "1" QuadGK = "2.11.1" Random = "1" Statistics = "1" -TensorKit = "0.14.6" +TensorKit = "0.14.9" TensorOperations = "5" TestExtras = "0.3" VectorInterface = "0.4, 0.5" diff --git a/src/environments/ctmrg_environments.jl b/src/environments/ctmrg_environments.jl index 4f50688ec..de85fe06e 100644 --- a/src/environments/ctmrg_environments.jl +++ b/src/environments/ctmrg_environments.jl @@ -384,10 +384,7 @@ cornertype(::Type{CTMRGEnv{C,E}}) where {C,E} = C edgetype(env::CTMRGEnv) = edgetype(typeof(env)) edgetype(::Type{CTMRGEnv{C,E}}) where {C,E} = E -TensorKit.spacetype(env::CTMRGEnv) = spacetype(typeof(env)) TensorKit.spacetype(::Type{E}) where {E<:CTMRGEnv} = spacetype(cornertype(E)) -TensorKit.sectortype(env::CTMRGEnv) = sectortype(typeof(env)) -TensorKit.sectortype(::Type{E}) where {E<:CTMRGEnv} = sectortype(cornertype(E)) # In-place update of environment function update!(env::CTMRGEnv{C,T}, env´::CTMRGEnv{C,T}) where {C,T} diff --git a/src/operators/infinitepepo.jl b/src/operators/infinitepepo.jl index 846da7ecb..cc3e7be88 100644 --- a/src/operators/infinitepepo.jl +++ b/src/operators/infinitepepo.jl @@ -150,6 +150,7 @@ end ## Spaces +TensorKit.spacetype(::Type{P}) where {P<:InfinitePEPO} = spacetype(eltype(P)) virtualspace(T::InfinitePEPO, r::Int, c::Int, h::Int, dir) = virtualspace(T[r, c, h], dir) domain_physicalspace(T::InfinitePEPO, r::Int, c::Int) = domain_physicalspace(T[r, c, 1]) function codomain_physicalspace(T::InfinitePEPO, r::Int, c::Int) diff --git a/src/operators/localoperator.jl b/src/operators/localoperator.jl index 1d925792e..7855b488c 100644 --- a/src/operators/localoperator.jl +++ b/src/operators/localoperator.jl @@ -188,9 +188,6 @@ end # Charge shifting # --------------- -TensorKit.sectortype(O::LocalOperator) = sectortype(typeof(O)) -TensorKit.sectortype(::Type{<:LocalOperator{T,S}}) where {T,S} = sectortype(S) -TensorKit.spacetype(O::LocalOperator) = spacetype(typeof(O)) TensorKit.spacetype(::Type{T}) where {S,T<:LocalOperator{<:Any,S}} = S @generated function _fuse_isomorphisms( diff --git a/src/states/infinitepartitionfunction.jl b/src/states/infinitepartitionfunction.jl index 3a08048b4..a558227ab 100644 --- a/src/states/infinitepartitionfunction.jl +++ b/src/states/infinitepartitionfunction.jl @@ -147,6 +147,7 @@ end ## Spaces +TensorKit.spacetype(::Type{T}) where {T<:InfinitePartitionFunction} = spacetype(eltype(T)) virtualspace(n::InfinitePartitionFunction, r::Int, c::Int, dir) = virtualspace(n[r, c], dir) ## InfiniteSquareNetwork interface diff --git a/src/states/infinitepeps.jl b/src/states/infinitepeps.jl index aa6c7862a..06e67cea7 100644 --- a/src/states/infinitepeps.jl +++ b/src/states/infinitepeps.jl @@ -139,9 +139,6 @@ end ## Spaces -TensorKit.sectortype(t::InfinitePEPS) = sectortype(typeof(t)) -TensorKit.sectortype(::Type{T}) where {T<:InfinitePEPS} = sectortype(eltype(T)) -TensorKit.spacetype(t::InfinitePEPS) = spacetype(typeof(t)) TensorKit.spacetype(::Type{T}) where {T<:InfinitePEPS} = spacetype(eltype(T)) virtualspace(n::InfinitePEPS, r::Int, c::Int, dir) = virtualspace(n[r, c], dir) physicalspace(n::InfinitePEPS, r::Int, c::Int) = physicalspace(n[r, c]) diff --git a/src/states/infiniteweightpeps.jl b/src/states/infiniteweightpeps.jl index 7d1503831..e0f45a589 100644 --- a/src/states/infiniteweightpeps.jl +++ b/src/states/infiniteweightpeps.jl @@ -66,10 +66,7 @@ Base.axes(W::SUWeight, args...) = axes(W.data, args...) Base.iterate(W::SUWeight, args...) = iterate(W.data, args...) ## spaces -TensorKit.spacetype(w::SUWeight) = spacetype(typeof(w)) TensorKit.spacetype(::Type{T}) where {E,T<:SUWeight{E}} = spacetype(E) -TensorKit.sectortype(w::SUWeight) = sectortype(typeof(w)) -TensorKit.sectortype(::Type{<:SUWeight{T}}) where {T} = sectortype(spacetype(T)) ## (Approximate) equality function Base.:(==)(wts1::SUWeight, wts2::SUWeight) @@ -216,10 +213,7 @@ function Base.size(peps::InfiniteWeightPEPS) return size(peps.vertices) end -TensorKit.spacetype(peps::InfiniteWeightPEPS) = spacetype(typeof(peps)) TensorKit.spacetype(::Type{T}) where {E,T<:InfiniteWeightPEPS{E}} = spacetype(E) -TensorKit.sectortype(peps::InfiniteWeightPEPS) = sectortype(typeof(peps)) -TensorKit.sectortype(::Type{<:InfiniteWeightPEPS{T}}) where {T} = sectortype(spacetype(T)) function _absorb_weights( t::PEPSTensor, diff --git a/test/ctmrg/partition_function.jl b/test/ctmrg/partition_function.jl index e74ed0295..cba765c0d 100644 --- a/test/ctmrg/partition_function.jl +++ b/test/ctmrg/partition_function.jl @@ -92,6 +92,11 @@ env0 = CTMRGEnv(Z, χenv) ctm_styles = [:sequential, :simultaneous] projector_algs = [:halfinfinite, :fullinfinite] +@test spacetype(typeof(Z)) === ComplexSpace +@test spacetype(Z) === ComplexSpace +@test sectortype(typeof(Z)) === Trivial +@test sectortype(Z) === Trivial + @testset "Classical Ising partition function using $alg with $projector_alg" for ( alg, projector_alg ) in Iterators.product( diff --git a/test/ctmrg/pepo.jl b/test/ctmrg/pepo.jl index a9880caf9..7acd262ad 100644 --- a/test/ctmrg/pepo.jl +++ b/test/ctmrg/pepo.jl @@ -69,6 +69,11 @@ projector_algs = [:halfinfinite, :fullinfinite] n = InfiniteSquareNetwork(psi0, T) env0 = CTMRGEnv(n, χenv) + @test spacetype(typeof(T)) === ComplexSpace + @test spacetype(T) === ComplexSpace + @test sectortype(typeof(T)) === Trivial + @test sectortype(T) === Trivial + @testset "PEPO CTMRG contraction using $alg with $projector_alg" for ( alg, projector_alg ) in Iterators.product(