Skip to content

Commit 3345413

Browse files
committed
Fix more namespace issues
1 parent cd6afc4 commit 3345413

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

src/infinitecanonicalmps.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ function infsiteinds(
166166
return infsiteinds(s, translator)
167167
end
168168

169-
function ITensors.linkinds::InfiniteMPS)
169+
function ITensorMPS.linkinds::InfiniteMPS)
170170
N = nsites(ψ)
171171
return CelledVector([linkinds(ψ, (n, n + 1)) for n in 1:N], translator(ψ))
172172
end
@@ -266,14 +266,14 @@ function finite_mps(ψ::InfiniteCanonicalMPS, range::AbstractRange)
266266
set_ortho_lims!(ψ_finite, (N + 1):(N + 1))
267267
return ψ_finite
268268
end
269-
function ITensors.expect::InfiniteCanonicalMPS, o::String, n::Int)
269+
function ITensorMPS.expect::InfiniteCanonicalMPS, o::String, n::Int)
270270
s = siteinds(only, ψ.AL)
271271
O = op(o, s[n])
272272
ϕ = ψ.AL[n] * ψ.C[n]
273273
return inner(ϕ, apply(O, ϕ))
274274
end
275275

276-
function ITensors.expect::InfiniteCanonicalMPS, h::MPO)
276+
function ITensorMPS.expect::InfiniteCanonicalMPS, h::MPO)
277277
l = linkinds(ITensorInfiniteMPS.only, ψ.AL)
278278
r = linkinds(ITensorInfiniteMPS.only, ψ.AR)
279279
s = siteinds(ITensorInfiniteMPS.only, ψ)
@@ -298,6 +298,6 @@ function ITensors.expect(ψ::InfiniteCanonicalMPS, h::MPO)
298298
return temp_O[]
299299
end
300300

301-
function ITensors.expect::InfiniteCanonicalMPS, h::InfiniteSum)
301+
function ITensorMPS.expect::InfiniteCanonicalMPS, h::InfiniteSum)
302302
return [expect(ψ, h[j]) for j in 1:nsites(ψ)]
303303
end

src/infinitemps.jl

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ function ITensors.dag(ψ::InfiniteCanonicalMPS, args...; kwargs...)
5757
return fmap(x -> dag(x, args...; kwargs...), ψ)
5858
end
5959

60-
ITensors.siteinds(f::typeof(only), ψ::InfiniteCanonicalMPS) = siteinds(f, ψ.AL)
60+
ITensorMPS.siteinds(f::typeof(only), ψ::InfiniteCanonicalMPS) = siteinds(f, ψ.AL)
6161

6262
getcell(i::Index) = ITensorInfiniteMPS.getcell(tags(i))
6363
getsite(i::Index) = getsite(tags(i))
6464

6565
#Before, for a two site Hamiltonian, findsites(ψ, H[3]) would return [1, 2]
6666
#Appeared unsafe for index purpose
67-
function ITensors.findfirstsiteind::InfiniteMPS, i::Index)
67+
function ITensorMPS.findfirstsiteind::InfiniteMPS, i::Index)
6868
c = ITensorInfiniteMPS.getcell(i)
6969
n1 = getsite(i)
7070
# if translator(ψ) == translatecelltags
@@ -95,28 +95,28 @@ function ITensors.findfirstsiteind(ψ::InfiniteMPS, i::Index)
9595
# return 0
9696
# end
9797
end
98-
function ITensors.findfirstsiteind::InfiniteCanonicalMPS, i::Index)
99-
return ITensors.findfirstsiteind.AL, i)
98+
function ITensorMPS.findfirstsiteind::InfiniteCanonicalMPS, i::Index)
99+
return ITensorMPS.findfirstsiteind.AL, i)
100100
end
101101

102-
function ITensors.findsites::InfiniteCanonicalMPS, is::Union{<:Tuple,<:Vector})
102+
function ITensorMPS.findsites::InfiniteCanonicalMPS, is::Union{<:Tuple,<:Vector})
103103
return sort([ITensors.findfirstsiteind(ψ, i) for i in is])
104104
end
105-
function ITensors.findsites::InfiniteMPS, is::Union{<:Tuple,<:Vector})
105+
function ITensorMPS.findsites::InfiniteMPS, is::Union{<:Tuple,<:Vector})
106106
return sort([ITensors.findfirstsiteind(ψ, i) for i in is])
107107
end
108-
function ITensors.findsites::InfiniteMPS, T::MPO)
108+
function ITensorMPS.findsites::InfiniteMPS, T::MPO)
109109
s = [noprime(filterinds(T[x]; plev=1)[1]) for x in 1:length(T)]
110110
return sort([ITensors.findfirstsiteind(ψ, i) for i in s])
111111
end
112-
ITensors.findsites::InfiniteCanonicalMPS, T::MPO) = findsites.AL, T)
112+
ITensorMPS.findsites::InfiniteCanonicalMPS, T::MPO) = findsites.AL, T)
113113

114114
#Kept for historical reason
115-
function ITensors.findsites::InfiniteMPS, T::ITensor)
115+
function ITensorMPS.findsites::InfiniteMPS, T::ITensor)
116116
s = filterinds(T; plev=0)
117117
return sort([ITensors.findfirstsiteind(ψ, i) for i in s])
118118
end
119-
ITensors.findsites::InfiniteCanonicalMPS, T::ITensor) = findsites.AL, T)
119+
ITensorMPS.findsites::InfiniteCanonicalMPS, T::ITensor) = findsites.AL, T)
120120

121121
# For now, only represents nearest neighbor interactions
122122
# on a linear chain
@@ -193,20 +193,20 @@ function nrange(h::MPO; ncell=1)
193193
return ns[end] - ns[1] + 1
194194
end
195195

196-
ITensors.findsites(h::InfiniteSum) = [findsites(h, n) for n in 1:nsites(h)]
197-
ITensors.findsites(h::InfiniteSum, n::Int64) = findsites(h.data[n]; ncell=nsites(h))
198-
#ITensors.findsites(h::InfiniteSum, is::Union{<:Tuple,<:Vector}) = [findsites(h.data[n], is) for n in 1:nsites(h)]
199-
#ITensors.findsites(h::InfiniteSum, i::Index) = [findsites(h.data[n], i) for n in 1:nsites(h)]
196+
ITensorMPS.findsites(h::InfiniteSum) = [findsites(h, n) for n in 1:nsites(h)]
197+
ITensorMPS.findsites(h::InfiniteSum, n::Int64) = findsites(h.data[n]; ncell=nsites(h))
198+
#ITensorMPS.findsites(h::InfiniteSum, is::Union{<:Tuple,<:Vector}) = [findsites(h.data[n], is) for n in 1:nsites(h)]
199+
#ITensorMPS.findsites(h::InfiniteSum, i::Index) = [findsites(h.data[n], i) for n in 1:nsites(h)]
200200
#TODO improve the findsites routines for Infinite Sum
201201

202-
function ITensors.findfirstsiteind(i::Index, ncell::Int64)
202+
function ITensorMPS.findfirstsiteind(i::Index, ncell::Int64)
203203
c = ITensorInfiniteMPS.getcell(i)
204204
n1 = getsite(i)
205205
return (c - 1) * ncell + n1
206206
end
207-
function ITensors.findsites(h::MPO; ncell::Int64=1)
207+
function ITensorMPS.findsites(h::MPO; ncell::Int64=1)
208208
s = [filterinds(h[x]; plev=1)[1] for x in 1:length(h)]
209-
return sort([ITensors.findfirstsiteind(i, ncell) for i in s])
209+
return sort([ITensorMPS.findfirstsiteind(i, ncell) for i in s])
210210
end
211211

212212
#Kept for historical reasons
@@ -223,12 +223,12 @@ function nrange(ψ::InfiniteCanonicalMPS, h::MPO)
223223
return ns[end] - ns[1] + 1
224224
end
225225

226-
function ITensors.findfirstsiteind(h::ITensor, i::Index, ncell::Int64)
226+
function ITensorMPS.findfirstsiteind(h::ITensor, i::Index, ncell::Int64)
227227
c = getcell(i)
228228
n1 = getsite(i)
229229
return (c - 1) * ncell + n1
230230
end
231-
function ITensors.findsites(h::ITensor; ncell::Int64=1)
231+
function ITensorMPS.findsites(h::ITensor; ncell::Int64=1)
232232
s = filterinds(h; plev=0)
233233
return sort([ITensors.findfirstsiteind(h, i, ncell) for i in s])
234234
end

0 commit comments

Comments
 (0)