Skip to content

Commit

Permalink
Add docstrings to documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
janikapeters committed Dec 19, 2024
1 parent 77c788c commit 1ed6abb
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 38 deletions.
2 changes: 2 additions & 0 deletions experimental/LieAlgebras/docs/src/root_systems.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ is_negative_root_with_index(::RootSpaceElem)
```@docs
reflect(::RootSpaceElem, ::Int)
reflect!(::RootSpaceElem, ::Int)
reflect(::RootSpaceElem, ::RootSpaceElem)
reflect!(::RootSpaceElem, ::RootSpaceElem)
```


Expand Down
2 changes: 2 additions & 0 deletions experimental/LieAlgebras/docs/src/weight_lattices.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ is_fundamental_weight_with_index(::WeightLatticeElem)
```@docs
reflect(::WeightLatticeElem, ::Int)
reflect!(::WeightLatticeElem, ::Int)
reflect(::WeightLatticeElem, ::RootSpaceElem)
reflect!(::WeightLatticeElem, ::RootSpaceElem)
```

### Conjugate dominant weight
Expand Down
15 changes: 13 additions & 2 deletions experimental/LieAlgebras/docs/src/weyl_groups.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ weyl_group(::Vector{Tuple{Symbol,Int}})
## Basic properties
Basic group arithmetic like `*`, and `inv` are defined for `WeylGroupElem` objects.

Using `(W::WeylGroup)(word::Vector{<:Integer})`, one can construct group elements from a word in the generators.

```@docs
is_finite(::WeylGroup)
one(::WeylGroup)
Expand All @@ -49,6 +47,19 @@ order(::Type{T}, ::WeylGroup) where {T}
root_system(::WeylGroup)
```

### Element constructors

Using `(W::WeylGroup)(word::Vector{<:Integer})`, one can construct group elements from a word in the generators.

```@docs; canonical=false
gen(::WeylGroup, ::Int)
gens(::WeylGroup)
```

```@docs
reflection(::RootSpaceElem)
```

### Words and length
```@docs
word(::WeylGroupElem)
Expand Down
36 changes: 0 additions & 36 deletions experimental/LieAlgebras/src/RootSystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1101,42 +1101,6 @@ function reflect!(r::RootSpaceElem, s::Int)
return r
end

@doc raw"""
reflection(beta::RootSpaceElem) -> WeylGroupElem
Return the Weyl group element corresponding to the reflection at the hyperplane orthogonal to root `beta`.
"""
function reflection(beta::RootSpaceElem)
R = root_system(beta)
W = weyl_group(R)
rk = number_of_simple_roots(R)

b, index_of_beta = is_positive_root_with_index(beta)
if !b
b, index_of_beta = is_negative_root_with_index(beta)
end
@req b "Not a root"

found_simple_root = index_of_beta <= rk
current_index = index_of_beta
list_of_indices = Int[]
while !found_simple_root
for j in 1:rk
next_index = W.refl[j, current_index]
if !iszero(next_index) &&
next_index < current_index
current_index = next_index
if current_index <= rk
found_simple_root = true
end
push!(list_of_indices, j)
break
end
end
end
return W([list_of_indices; current_index; reverse(list_of_indices)])
end

@doc raw"""
reflect(r::RootSpaceElem, beta::RootSpaceElem) -> RootSpaceElem
Expand Down
36 changes: 36 additions & 0 deletions experimental/LieAlgebras/src/WeylGroup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,42 @@ function word(x::WeylGroupElem)
return x.word
end

@doc raw"""
reflection(beta::RootSpaceElem) -> WeylGroupElem
Return the Weyl group element corresponding to the reflection at the hyperplane orthogonal to root `beta`.
"""
function reflection(beta::RootSpaceElem)
R = root_system(beta)
W = weyl_group(R)
rk = number_of_simple_roots(R)

b, index_of_beta = is_positive_root_with_index(beta)
if !b
b, index_of_beta = is_negative_root_with_index(beta)
end
@req b "Not a root"

found_simple_root = index_of_beta <= rk
current_index = index_of_beta
list_of_indices = Int[]
while !found_simple_root
for j in 1:rk
next_index = W.refl[j, current_index]
if !iszero(next_index) &&
next_index < current_index
current_index = next_index
if current_index <= rk
found_simple_root = true
end
push!(list_of_indices, j)
break
end
end
end
return W([list_of_indices; current_index; reverse(list_of_indices)])
end

@doc raw"""
fp_group(W::WeylGroup) -> FPGroup
Expand Down

0 comments on commit 1ed6abb

Please sign in to comment.