Skip to content

Commit

Permalink
Improve error message for SUNIrrep(dynkin_labels)
Browse files Browse the repository at this point in the history
  • Loading branch information
lkdvos committed Jan 18, 2024
1 parent 76f1447 commit 82b5b4d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/SUNRepresentations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ SUNIrrep{N}(args::Vararg{Int}) where {N} = SUNIrrep{N}(args)

SUNIrrep(a::Vector{Int}) = SUNIrrep{length(a) + 1}(a)
function SUNIrrep{N}(a::Vector{Int}) where {N}
@assert length(a) == N - 1
length(a) == N - 1 ||
throw(ArgumentError("Dynkin labels for `SUNIrrep{$N}` should be a vector of length $(N - 1)"))
return SUNIrrep{N}(reverse(cumsum(reverse(a)))..., 0)
end

Expand Down

0 comments on commit 82b5b4d

Please sign in to comment.