Skip to content

Commit 7caf5b1

Browse files
authored
Define spacetype(InfinitePartitionFunction) (#241)
1 parent b2d8b76 commit 7caf5b1

File tree

9 files changed

+13
-16
lines changed

9 files changed

+13
-16
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Printf = "1"
4141
QuadGK = "2.11.1"
4242
Random = "1"
4343
Statistics = "1"
44-
TensorKit = "0.14.6"
44+
TensorKit = "0.14.9"
4545
TensorOperations = "5"
4646
TestExtras = "0.3"
4747
VectorInterface = "0.4, 0.5"

src/environments/ctmrg_environments.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,10 +384,7 @@ cornertype(::Type{CTMRGEnv{C,E}}) where {C,E} = C
384384
edgetype(env::CTMRGEnv) = edgetype(typeof(env))
385385
edgetype(::Type{CTMRGEnv{C,E}}) where {C,E} = E
386386

387-
TensorKit.spacetype(env::CTMRGEnv) = spacetype(typeof(env))
388387
TensorKit.spacetype(::Type{E}) where {E<:CTMRGEnv} = spacetype(cornertype(E))
389-
TensorKit.sectortype(env::CTMRGEnv) = sectortype(typeof(env))
390-
TensorKit.sectortype(::Type{E}) where {E<:CTMRGEnv} = sectortype(cornertype(E))
391388

392389
# In-place update of environment
393390
function update!(env::CTMRGEnv{C,T}, env´::CTMRGEnv{C,T}) where {C,T}

src/operators/infinitepepo.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ end
150150

151151
## Spaces
152152

153+
TensorKit.spacetype(::Type{P}) where {P<:InfinitePEPO} = spacetype(eltype(P))
153154
virtualspace(T::InfinitePEPO, r::Int, c::Int, h::Int, dir) = virtualspace(T[r, c, h], dir)
154155
domain_physicalspace(T::InfinitePEPO, r::Int, c::Int) = domain_physicalspace(T[r, c, 1])
155156
function codomain_physicalspace(T::InfinitePEPO, r::Int, c::Int)

src/operators/localoperator.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,6 @@ end
188188

189189
# Charge shifting
190190
# ---------------
191-
TensorKit.sectortype(O::LocalOperator) = sectortype(typeof(O))
192-
TensorKit.sectortype(::Type{<:LocalOperator{T,S}}) where {T,S} = sectortype(S)
193-
TensorKit.spacetype(O::LocalOperator) = spacetype(typeof(O))
194191
TensorKit.spacetype(::Type{T}) where {S,T<:LocalOperator{<:Any,S}} = S
195192

196193
@generated function _fuse_isomorphisms(

src/states/infinitepartitionfunction.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ end
147147

148148
## Spaces
149149

150+
TensorKit.spacetype(::Type{T}) where {T<:InfinitePartitionFunction} = spacetype(eltype(T))
150151
virtualspace(n::InfinitePartitionFunction, r::Int, c::Int, dir) = virtualspace(n[r, c], dir)
151152

152153
## InfiniteSquareNetwork interface

src/states/infinitepeps.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,6 @@ end
139139

140140
## Spaces
141141

142-
TensorKit.sectortype(t::InfinitePEPS) = sectortype(typeof(t))
143-
TensorKit.sectortype(::Type{T}) where {T<:InfinitePEPS} = sectortype(eltype(T))
144-
TensorKit.spacetype(t::InfinitePEPS) = spacetype(typeof(t))
145142
TensorKit.spacetype(::Type{T}) where {T<:InfinitePEPS} = spacetype(eltype(T))
146143
virtualspace(n::InfinitePEPS, r::Int, c::Int, dir) = virtualspace(n[r, c], dir)
147144
physicalspace(n::InfinitePEPS, r::Int, c::Int) = physicalspace(n[r, c])

src/states/infiniteweightpeps.jl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,7 @@ Base.axes(W::SUWeight, args...) = axes(W.data, args...)
6666
Base.iterate(W::SUWeight, args...) = iterate(W.data, args...)
6767

6868
## spaces
69-
TensorKit.spacetype(w::SUWeight) = spacetype(typeof(w))
7069
TensorKit.spacetype(::Type{T}) where {E,T<:SUWeight{E}} = spacetype(E)
71-
TensorKit.sectortype(w::SUWeight) = sectortype(typeof(w))
72-
TensorKit.sectortype(::Type{<:SUWeight{T}}) where {T} = sectortype(spacetype(T))
7370

7471
## (Approximate) equality
7572
function Base.:(==)(wts1::SUWeight, wts2::SUWeight)
@@ -216,10 +213,7 @@ function Base.size(peps::InfiniteWeightPEPS)
216213
return size(peps.vertices)
217214
end
218215

219-
TensorKit.spacetype(peps::InfiniteWeightPEPS) = spacetype(typeof(peps))
220216
TensorKit.spacetype(::Type{T}) where {E,T<:InfiniteWeightPEPS{E}} = spacetype(E)
221-
TensorKit.sectortype(peps::InfiniteWeightPEPS) = sectortype(typeof(peps))
222-
TensorKit.sectortype(::Type{<:InfiniteWeightPEPS{T}}) where {T} = sectortype(spacetype(T))
223217

224218
function _absorb_weights(
225219
t::PEPSTensor,

test/ctmrg/partition_function.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ env0 = CTMRGEnv(Z, χenv)
9292
ctm_styles = [:sequential, :simultaneous]
9393
projector_algs = [:halfinfinite, :fullinfinite]
9494

95+
@test spacetype(typeof(Z)) === ComplexSpace
96+
@test spacetype(Z) === ComplexSpace
97+
@test sectortype(typeof(Z)) === Trivial
98+
@test sectortype(Z) === Trivial
99+
95100
@testset "Classical Ising partition function using $alg with $projector_alg" for (
96101
alg, projector_alg
97102
) in Iterators.product(

test/ctmrg/pepo.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ projector_algs = [:halfinfinite, :fullinfinite]
6969
n = InfiniteSquareNetwork(psi0, T)
7070
env0 = CTMRGEnv(n, χenv)
7171

72+
@test spacetype(typeof(T)) === ComplexSpace
73+
@test spacetype(T) === ComplexSpace
74+
@test sectortype(typeof(T)) === Trivial
75+
@test sectortype(T) === Trivial
76+
7277
@testset "PEPO CTMRG contraction using $alg with $projector_alg" for (
7378
alg, projector_alg
7479
) in Iterators.product(

0 commit comments

Comments
 (0)