Skip to content

Commit

Permalink
Similar to previous commit but for FermionNumber and FermionSpin
Browse files Browse the repository at this point in the history
  • Loading branch information
lkdvos committed Jan 17, 2024
1 parent 91344d7 commit c1e0e27
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/sectors/fermions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,17 @@ Base.isless(a::FermionParity, b::FermionParity) = isless(a.isodd, b.isodd)

const FermionNumber = U1Irrep FermionParity
const fU₁ = FermionNumber
fU₁(a::Int) = U1Irrep(a) FermionParity(isodd(a))
type_repr(::Type{fU₁}) = "fU₁"
FermionNumber(a::Int) = U1Irrep(a) FermionParity(isodd(a))
type_repr(::Type{FermionNumber}) = "FermionNumber"

# convenience default converter -> allows Vect[fU₁](1 => 1)
Base.convert(::Type{fU₁}, a::Int) = fU₁(a)
# convenience default converter -> allows Vect[FermionNumber](1 => 1)
Base.convert(::Type{FermionNumber}, a::Int) = FermionNumber(a)

const FermionSpin = SU2Irrep FermionParity
const fSU₂ = FermionSpin
fSU₂(a::Real) = (s = SU2Irrep(a);
s FermionParity(isodd(twice(s.j))))
type_repr(::Type{fSU₂}) = "fSU₂"
FermionSpin(a::Real) = (s = SU2Irrep(a);
s FermionParity(isodd(twice(s.j))))
type_repr(::Type{FermionSpin}) = "FermionSpin"

# convenience default converter -> allows Vect[fSU₂](1 => 1)
Base.convert(::Type{fSU₂}, a::Real) = fSU₂(a)
# convenience default converter -> allows Vect[FermionSpin](1 => 1)
Base.convert(::Type{FermionSpin}, a::Real) = FermionSpin(a)

0 comments on commit c1e0e27

Please sign in to comment.