Skip to content

Commit

Permalink
Fix ambiguities
Browse files Browse the repository at this point in the history
  • Loading branch information
lkdvos committed Jan 2, 2025
1 parent d99c4a3 commit 5e41ffd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/anyons.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Base.length(::SectorValues{FibonacciAnyon}) = 2
function Base.iterate(::SectorValues{FibonacciAnyon}, i=0)
return i == 0 ? (FibonacciAnyon(:I), 1) : (i == 1 ? (FibonacciAnyon(), 2) : nothing)
end
function Base.getindex(S::SectorValues{FibonacciAnyon}, i)
function Base.getindex(S::SectorValues{FibonacciAnyon}, i::Int)
if i == 1
return FibonacciAnyon(:I)
elseif i == 2
Expand Down Expand Up @@ -177,7 +177,7 @@ const all_isinganyons = (IsingAnyon(:I), IsingAnyon(:σ), IsingAnyon(:ψ))
Base.IteratorSize(::Type{SectorValues{IsingAnyon}}) = HasLength()
Base.length(::SectorValues{IsingAnyon}) = length(all_isinganyons)
Base.iterate(::SectorValues{IsingAnyon}, i=1) = iterate(all_isinganyons, i)
Base.getindex(S::SectorValues{IsingAnyon}, i) = getindex(all_isinganyons, i)
Base.getindex(::SectorValues{IsingAnyon}, i::Int) = getindex(all_isinganyons, i)

function findindex(::SectorValues{IsingAnyon}, a::IsingAnyon)
a == all_isinganyons[1] && return 1
Expand Down
2 changes: 1 addition & 1 deletion src/fermions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Base.length(::SectorValues{FermionParity}) = 2
function Base.iterate(::SectorValues{FermionParity}, i=0)
return i == 2 ? nothing : (FermionParity(i), i + 1)
end
function Base.getindex(::SectorValues{FermionParity}, i)
function Base.getindex(::SectorValues{FermionParity}, i::Int)
return 1 <= i <= 2 ? FermionParity(i - 1) : throw(BoundsError(values(FermionParity), i))
end
findindex(::SectorValues{FermionParity}, f::FermionParity) = f.isodd ? 2 : 1
Expand Down

0 comments on commit 5e41ffd

Please sign in to comment.