Skip to content

Commit 7a07140

Browse files
authored
More informative errors for finite mps (#367)
* specify method * check spacetype * be happy with anything that acts like a vector
1 parent e5b33b6 commit 7a07140

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/algorithms/toolbox.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ function transfer_spectrum(
9494
init = randomize!(
9595
similar(
9696
above.AL[1], left_virtualspace(below, 1),
97-
ℂ[typeof(sector)](sector => 1)' * left_virtualspace(above, 1)
97+
spacetype(above)(sector => 1)' * left_virtualspace(above, 1)
9898
)
9999
)
100100

@@ -151,7 +151,7 @@ function marek_gap(above::InfiniteMPS; tol_angle = 0.1, kwargs...)
151151
return marek_gap(spectrum; tol_angle)
152152
end
153153

154-
function marek_gap(spectrum; tol_angle = 0.1)
154+
function marek_gap(spectrum::AbstractVector{T}; tol_angle = 0.1) where {T <: Number}
155155
# Remove 1s from the spectrum
156156
inds = findall(abs.(spectrum) .< 1 - 1.0e-12)
157157
length(spectrum) - length(inds) < 2 || @warn "Non-injective mps?"
@@ -187,7 +187,7 @@ function correlation_length(above::InfiniteMPS; kwargs...)
187187
return 1 / ϵ
188188
end
189189

190-
function correlation_length(spectrum; kwargs...)
190+
function correlation_length(spectrum::AbstractVector{T}; kwargs...) where {T <: Number}
191191
ϵ, = marek_gap(spectrum; kwargs...)
192192
return 1 / ϵ
193193
end

0 commit comments

Comments
 (0)