Skip to content

Commit

Permalink
Fix more namespace issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfishman committed Oct 26, 2024
1 parent 6dd5b51 commit 16724ff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/infinitemps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,21 +100,21 @@ function ITensorMPS.findfirstsiteind(ψ::InfiniteCanonicalMPS, i::Index)
end

function ITensorMPS.findsites::InfiniteCanonicalMPS, is::Union{<:Tuple,<:Vector})
return sort([ITensors.findfirstsiteind(ψ, i) for i in is])
return sort([ITensorMPS.findfirstsiteind(ψ, i) for i in is])
end
function ITensorMPS.findsites::InfiniteMPS, is::Union{<:Tuple,<:Vector})
return sort([ITensors.findfirstsiteind(ψ, i) for i in is])
return sort([ITensorMPS.findfirstsiteind(ψ, i) for i in is])
end
function ITensorMPS.findsites::InfiniteMPS, T::MPO)
s = [noprime(filterinds(T[x]; plev=1)[1]) for x in 1:length(T)]
return sort([ITensors.findfirstsiteind(ψ, i) for i in s])
return sort([ITensorMPS.findfirstsiteind(ψ, i) for i in s])
end
ITensorMPS.findsites::InfiniteCanonicalMPS, T::MPO) = findsites.AL, T)

#Kept for historical reason
function ITensorMPS.findsites::InfiniteMPS, T::ITensor)
s = filterinds(T; plev=0)
return sort([ITensors.findfirstsiteind(ψ, i) for i in s])
return sort([ITensorMPS.findfirstsiteind(ψ, i) for i in s])
end
ITensorMPS.findsites::InfiniteCanonicalMPS, T::ITensor) = findsites.AL, T)

Expand Down Expand Up @@ -230,7 +230,7 @@ function ITensorMPS.findfirstsiteind(h::ITensor, i::Index, ncell::Int64)
end
function ITensorMPS.findsites(h::ITensor; ncell::Int64=1)
s = filterinds(h; plev=0)
return sort([ITensors.findfirstsiteind(h, i, ncell) for i in s])
return sort([ITensorMPS.findfirstsiteind(h, i, ncell) for i in s])
end

## HDF5 support for the InfiniteCanonicalMPS type
Expand Down
10 changes: 5 additions & 5 deletions src/models/models.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ function InfiniteSum{ITensor}(model::Model, s::CelledVector; kwargs...)
end

# Get the first site with nontrivial support of the OpSum
first_site(opsum::OpSum) = minimum(ITensorMPS.sites(opsum))
last_site(opsum::OpSum) = maximum(ITensorMPS.sites(opsum))
first_site(opsum::OpSum) = minimum(ITensors.sites(opsum))
last_site(opsum::OpSum) = maximum(ITensors.sites(opsum))

function set_site(o::Op, s::Int)
return Op(ITensorMPS.which_op(o), s; ITensorMPS.params(o)...)
Expand Down Expand Up @@ -66,7 +66,7 @@ function InfiniteSum{MPO}(opsum::OpSum, s::CelledVector)
nrange = 0 # Maximum operator support
opsums = [OpSum() for _ in 1:n]
for o in ITensorMPS.terms(opsum)
js = sort(ITensorMPS.sites(o))
js = sort(ITensors.sites(o))
j1 = first(js)
nrange = max(nrange, last(js) - j1 + 1)
opsums[j1] += o
Expand Down Expand Up @@ -243,7 +243,7 @@ function infinite_terms(opsum::OpSum; kwargs...)
# contains the terms with support starting on that
# site of the unit cell, i.e. `opsum_cell[i]`
# stores all terms starting on site `i`.
opsum_cell_dict = groupreduce(minimum ITensorMPS.sites, +, opsum)
opsum_cell_dict = groupreduce(minimum ITensors.sites, +, opsum)
nsites = maximum(keys(opsum_cell_dict))
# check that we don't have terms we will ignore
dropped = filter(x -> x <= 0, keys(opsum_cell_dict))
Expand Down Expand Up @@ -299,7 +299,7 @@ function finite_terms(model::Model, n::Int; kwargs...)
_finite_terms = OpSum[]
for j in 1:n
term_j = _infite_terms[j]
filtered_term_j = filter_terms(s -> all((n), s), term_j; by=ITensorMPS.sites)
filtered_term_j = filter_terms(s -> all((n), s), term_j; by=ITensors.sites)
push!(_finite_terms, filtered_term_j)
end
return _finite_terms
Expand Down

0 comments on commit 16724ff

Please sign in to comment.