diff --git a/src/QuantumNumbers.jl b/src/QuantumNumbers.jl index 3c6be593..aacbecfe 100644 --- a/src/QuantumNumbers.jl +++ b/src/QuantumNumbers.jl @@ -422,6 +422,7 @@ struct Momenta{P<:𝕂} <: RepresentationSpace{P} end @inline Base.convert(::Type{P}, index::CartesianIndex, ::Momenta{P}) where {P<:𝕂} = P(reverse(index.I)...) @inline Base.:(==)(ms₁::Momenta, ms₂::Momenta) = periods(eltype(ms₁))==periods(eltype(ms₂)) @inline Base.isequal(ms₁::Momenta, ms₂::Momenta) = isequal(periods(eltype(ms₁)), periods(eltype(ms₂))) +@inline Base.show(io::IO, ms::Momenta) = @printf io "Momenta(%s)" eltype(ms) """ regularize!(quantumnumbers::Vector{<:AbelianQuantumNumber}, dimensions::Vector{Int}; check::Bool=false) -> Tuple{typeof(quantumnumbers), typeof(dimensions), Vector{Int}} diff --git a/test/QuantumNumbers.jl b/test/QuantumNumbers.jl index 052a7d56..84147a65 100644 --- a/test/QuantumNumbers.jl +++ b/test/QuantumNumbers.jl @@ -70,7 +70,8 @@ end @test collect(momenta) == [𝕂²{2, 3}(0, 0), 𝕂²{2, 3}(0, 1), 𝕂²{2, 3}(0, 2), 𝕂²{2, 3}(1, 0), 𝕂²{2, 3}(1, 1), 𝕂²{2, 3}(1, 2)] for momentum in momenta @test momenta[convert(CartesianIndex, momentum, momenta)] == momentum - end + end + @test string(momenta) == "Momenta(𝕂²{2, 3})" end @testset "regularize" begin