Skip to content

Commit

Permalink
fix get_conjugate for unassigned value
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasBreuer committed Oct 14, 2024
1 parent 3ed7c49 commit 72450c6
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/Groups/pcgroup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ Get the relative order of the `i`-th generator of `c`.
```jldoctest
julia> c = collector(2, Int);
julia> get_relative_order(c, 1)
0
julia> set_relative_order!(c, 1, 2)
julia> get_relative_order(c, 1)
Expand Down Expand Up @@ -160,6 +163,11 @@ Get the `Vector{T}` of all relative orders of the generators of `c`.
```jldoctest
julia> c = collector(2);
julia> get_relative_orders(c)
2-element Vector{ZZRingElem}:
0
0
julia> set_relative_orders!(c, ZZRingElem[2, 0])
julia> get_relative_orders(c)
Expand Down Expand Up @@ -219,6 +227,9 @@ julia> set_relative_order!(c, 1, 2)
julia> set_relative_order!(c, 2, 3)
julia> get_power(c, 1)
Pair{Int64, Int64}[]
julia> set_power!(c, 1, [2 => 1])
julia> get_power(c, 1)
Expand Down Expand Up @@ -277,6 +288,10 @@ julia> c = collector(2, Int);
julia> set_relative_orders!(c, [2, 3])
julia> get_conjugate(c, 2, 1)
1-element Vector{Pair{Int64, Int64}}:
2 => 1
julia> set_conjugate!(c, 2, 1, [2 => 2])
julia> get_conjugate(c, 2, 1)
Expand All @@ -287,7 +302,8 @@ julia> get_conjugate(c, 2, 1)
function get_conjugate(c::Collector{T}, j::Int, i::Int) where T <: IntegerUnion
@req 0 < i <= c.ngens "the collector has only $(c.ngens) generators not $i"
@req i < j "only for i < j, but i = $i, j = $j"
return c.conjugates[i,j]
conj = c.conjugates
return isassigned(conj, i, j) ? conj[i, j] : [j => T(1)]
end

"""
Expand Down

0 comments on commit 72450c6

Please sign in to comment.