Skip to content

Commit

Permalink
Change the show of AbelianQuantumNumberProd.
Browse files Browse the repository at this point in the history
  • Loading branch information
waltergu committed Dec 31, 2024
1 parent b084dcc commit 226c964
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/QuantumNumbers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ struct AbelianQuantumNumberProd{T<:Tuple{Vararg{SimpleAbelianQuantumNumber}}} <:
contents::T
end
@inline Base.hash(qn::AbelianQuantumNumberProd, h::UInt) = hash(values(qn), h)
@inline Base.show(io::IO, qn::AbelianQuantumNumberProd) = @printf io "Abelian[%s]%s" join(fieldtypes(fieldtype(typeof(qn), :contents)), "") values(qn)
@inline Base.show(io::IO, qn::AbelianQuantumNumberProd) = @printf io "%s" join(qn.contents, "")
@inline Base.show(io::IO, ::Type{AbelianQuantumNumberProd{T}}) where {T<:Tuple{Vararg{SimpleAbelianQuantumNumber}}} = @printf io "%s" join(fieldtypes(T), "")
@inline Base.zero(::Type{AbelianQuantumNumberProd{T}}) where {T<:Tuple{Vararg{SimpleAbelianQuantumNumber}}} = AbelianQuantumNumberProd(map(zero, fieldtypes(T)))
@inline periods(::Type{AbelianQuantumNumberProd{T}}) where {T<:Tuple{Vararg{SimpleAbelianQuantumNumber}}} = map(period, fieldtypes(T))
Expand Down
2 changes: 1 addition & 1 deletion test/QuantumNumbers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ using QuantumLattices.QuantumNumbers
@test values(sp) == (1, 1/2) && value(sp, 1)==1 && value(sp, 2)==1/2
@test sp == Abelian[ℕ 𝕊ᶻ](1, 1/2) == Abelian[ℕ 𝕊ᶻ]((1, 1/2)) == AbelianQuantumNumberProd(n, sz)
@test hash(sp, UInt(1)) == hash((n.charge, sz.charge), UInt(1))
@test string(sp) == "Abelian[ℕ ⊠ 𝕊ᶻ](1, 1/2)"
@test string(sp) == "ℕ(1) ⊠ 𝕊ᶻ(1/2)"
@test zero(sp) == zero(typeof(sp)) == Abelian[ℕ 𝕊ᶻ](0, 0)
@test length(sp) == rank(sp) == rank(typeof(sp)) == 2
@test sp[1]==sp[begin]==n && sp[2]==sp[end]==sz
Expand Down

0 comments on commit 226c964

Please sign in to comment.