Skip to content

Commit

Permalink
LieAlgebras: Streamline exports in Oscar.LieAlgebras (#4036)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens authored Sep 10, 2024
1 parent 7f113ec commit 224cb53
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 225 deletions.
2 changes: 1 addition & 1 deletion experimental/Experimental.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const orderedpkgs = [
"SetPartitions",
"PartitionedPermutations", # needs code from SetPartitions
"Schemes",
"FTheoryTools", # must be loaded after Schemes
"FTheoryTools", # must be loaded after Schemes and LieAlgebras
"IntersectionTheory", # must be loaded after Schemes
]
const exppkgs = filter(x->isdir(joinpath(expdir, x)) && !(x in orderedpkgs), readdir(expdir))
Expand Down
2 changes: 1 addition & 1 deletion experimental/FTheoryTools/src/FamilyOfSpaces/attributes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ Ideal generated by
ring = coordinate_ring(f)
variables = gens(ring)
all_indices = collect(1:length(variables))
combis = Oscar.combinations(length(variables), dim(f))
combis = AbstractAlgebra.combinations(length(variables), dim(f))
combis = [setdiff(all_indices, c) for c in combis]
ideal_generators = [prod([variables[i] for i in c]) for c in combis]
return ideal(ideal_generators)
Expand Down
26 changes: 13 additions & 13 deletions experimental/LieAlgebras/src/Combinatorics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
# more efficient implementation.

function combinations(n::Integer, k::Integer)
return sort(subsets(n, k))
return sort(AbstractAlgebra.combinations(n, k))
end

@doc raw"""
combinations(v::AbstractVector{T}, k::Integer) where {T}
Oscar.LieAlgebras.combinations(v::AbstractVector{T}, k::Integer) where {T}
Return an iterator over all combinations of `k` elements of `v`.
In each iteration, the elements are returned in the order they appear in `v`.
The order of the combinations is lexicographic.
```jldoctest; setup = :(using Oscar.LieAlgebras)
julia> collect(combinations([1, 2, 3, 4], 2))
```jldoctest
julia> collect(Oscar.LieAlgebras.combinations([1, 2, 3, 4], 2))
6-element Vector{Vector{Int64}}:
[1, 2]
[1, 3]
Expand All @@ -39,14 +39,14 @@ function multicombinations(n::Integer, k::Integer)
end

@doc raw"""
multicombinations(v::AbstractVector{T}, k::Integer) where {T}
Oscar.LieAlgebras.multicombinations(v::AbstractVector{T}, k::Integer) where {T}
Return an iterator over all combinations of `k` elements of `v` with repetitions.
In each iteration, the elements are returned in the order they appear in `v`.
The order of the combinations is lexicographic.
```jldoctest; setup = :(using Oscar.LieAlgebras)
julia> collect(multicombinations([1, 2, 3, 4], 2))
```jldoctest
julia> collect(Oscar.LieAlgebras.multicombinations([1, 2, 3, 4], 2))
10-element Vector{Vector{Int64}}:
[1, 1]
[1, 2]
Expand All @@ -70,13 +70,13 @@ function permutations(n::Integer)
end

@doc raw"""
permutations(v::AbstractVector{T}) where {T}
Oscar.LieAlgebras.permutations(v::AbstractVector{T}) where {T}
Return an iterator over all permutations of `v`.
There is no guarantee on the order of the permutations.
```jldoctest; setup = :(using Oscar.LieAlgebras)
julia> sort(collect(permutations([1, 2, 3])))
```jldoctest
julia> sort(collect(Oscar.LieAlgebras.permutations([1, 2, 3])))
6-element Vector{Vector{Int64}}:
[1, 2, 3]
[1, 3, 2]
Expand All @@ -96,13 +96,13 @@ function permutations_with_sign(n::Integer)
end

@doc raw"""
permutations_with_sign(v::AbstractVector{T}) where {T}
Oscar.LieAlgebras.permutations_with_sign(v::AbstractVector{T}) where {T}
Return an iterator over all permutations of `v` with their sign.
There is no guarantee on the order of the permutations.
```jldoctest; setup = :(using Oscar.LieAlgebras)
julia> sort(collect(permutations_with_sign([1, 2, 3])))
```jldoctest
julia> sort(collect(Oscar.LieAlgebras.permutations_with_sign([1, 2, 3])))
6-element Vector{Tuple{Vector{Int64}, Int64}}:
([1, 2, 3], 1)
([1, 3, 2], -1)
Expand Down
215 changes: 8 additions & 207 deletions experimental/LieAlgebras/src/LieAlgebras.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,120 +87,19 @@ Oscar.@import_all_serialization_functions

import Base: getindex, deepcopy_internal, hash, issubset, iszero, parent, zero

export AbstractLieAlgebra, AbstractLieAlgebraElem
export DirectSumLieAlgebra, DirectSumLieAlgebraElem
export DualRootSpaceElem
export LieAlgebra, LieAlgebraElem
export LieAlgebraHom
export LieAlgebraIdeal
export LieAlgebraModule, LieAlgebraModuleElem
export LieAlgebraModuleHom
export LieSubalgebra
export LinearLieAlgebra, LinearLieAlgebraElem
export RootSpaceElem
export RootSystem
export WeightLatticeElem
export WeylGroup, WeylGroupElem
export WeylOrbitIterator
include("exports.jl")

# The following export statements export things *into* module Oscar;
# they are however for internal use and thus are not exported *from* Oscar.
export _is_direct_sum
export _is_dual
export _is_exterior_power
export _is_standard_module
export _is_symmetric_power
export _is_tensor_power
export _is_tensor_product
export abelian_lie_algebra
export abstract_module
export base_lie_algebra
export bilinear_form
export bracket
export cartan_bilinear_form
export cartan_matrix
export cartan_symmetrizer
export cartan_type
export cartan_type_with_ordering
export chevalley_basis
export coefficient_vector
export coerce_to_lie_algebra_elem
export combinations
export conjugate_dominant_weight
export conjugate_dominant_weight_with_elem
export coroot
export coroots
export coxeter_matrix
export derived_algebra
export dim_of_simple_module
export dominant_character
export exterior_power
export fundamental_weight
export fundamental_weights
export general_linear_lie_algebra
export induced_map_on_symmetric_power
export induced_map_on_tensor_power
export is_cartan_matrix
export is_cartan_type
export is_coroot
export is_coroot_with_index
export is_dominant
export is_negative_coroot
export is_negative_coroot_with_index
export is_negative_root
export is_negative_root_with_index
export is_positive_coroot
export is_positive_coroot_with_index
export is_positive_root
export is_positive_root_with_index
export is_root
export is_root_with_index
export is_self_normalizing
export is_simple_coroot
export is_simple_coroot_with_index
export is_simple_root
export is_simple_root_with_index
export lie_algebra
export lmul, lmul!
export longest_element
export lower_central_series
export matrix_repr_basis
export multicombinations
export negative_coroot
export negative_coroots
export negative_root
export negative_roots
export number_of_positive_roots
export number_of_roots
export number_of_simple_roots
export permutations
export permutations_with_sign
export positive_coroot
export positive_coroots
export positive_root
export positive_roots
export reduced_expressions
export reflect, reflect!
export root_system, has_root_system
export root_system_type, has_root_system_type
export root_system_type_with_ordering
export show_dynkin_diagram
export simple_coroot
export simple_coroots
export simple_module
export simple_root
export simple_roots
export special_linear_lie_algebra
export special_orthogonal_lie_algebra
export standard_module
export symmetric_power
export symplectic_lie_algebra
export tensor_power
export tensor_product_decomposition
export trivial_module
export universal_enveloping_algebra
export weyl_group
export weyl_orbit
export word

# Aliases
function number_of_positive_roots end
function number_of_roots end
function number_of_simple_roots end
Expand Down Expand Up @@ -241,106 +140,8 @@ end # module LieAlgebras

using .LieAlgebras

export AbstractLieAlgebra, AbstractLieAlgebraElem
export DirectSumLieAlgebra, DirectSumLieAlgebraElem
export DualRootSpaceElem
export LieAlgebra, LieAlgebraElem
export LieAlgebraHom
export LieAlgebraIdeal
export LieAlgebraModule, LieAlgebraModuleElem
export LieAlgebraModuleHom
export LieSubalgebra
export LinearLieAlgebra, LinearLieAlgebraElem
export RootSpaceElem
export RootSystem
export WeightLatticeElem
export WeylGroup, WeylGroupElem
export WeylOrbitIterator
include("exports.jl")

export abelian_lie_algebra
export abstract_module
export base_lie_algebra
export bilinear_form
export bracket
export cartan_bilinear_form
export cartan_matrix
export cartan_symmetrizer
export cartan_type
export cartan_type_with_ordering
export chevalley_basis
export coerce_to_lie_algebra_elem
export conjugate_dominant_weight
export conjugate_dominant_weight_with_elem
export coroot
export coroots
export coxeter_matrix
export derived_algebra
export dim_of_simple_module
export dominant_character
export exterior_power
export fundamental_weight
export fundamental_weights
export general_linear_lie_algebra
export induced_map_on_symmetric_power
export induced_map_on_tensor_power
export is_cartan_matrix
export is_cartan_type
export is_coroot
export is_coroot_with_index
export is_dominant
export is_negative_coroot
export is_negative_coroot_with_index
export is_negative_root
export is_negative_root_with_index
export is_positive_coroot
export is_positive_coroot_with_index
export is_positive_root
export is_positive_root_with_index
export is_root
export is_root_with_index
export is_self_normalizing
export is_simple_coroot
export is_simple_coroot_with_index
export is_simple_root
export is_simple_root_with_index
export lie_algebra
export lmul, lmul!
export longest_element
export lower_central_series
export matrix_repr_basis
export negative_coroot
export negative_coroots
export negative_root
export negative_roots
export number_of_positive_roots, n_positive_roots # alias lives in a submodule
export number_of_roots, n_roots # alias lives in a submodule
export number_of_simple_roots, n_simple_roots # alias lives in a submodule
export positive_coroot
export positive_coroots
export positive_root
export positive_roots
export reduced_expressions
export reflect, reflect!
export root
export root_system, has_root_system
export root_system_type, has_root_system_type
export root_system_type_with_ordering
export roots
export show_dynkin_diagram
export simple_coroot
export simple_coroots
export simple_module
export simple_root
export simple_roots
export special_linear_lie_algebra
export special_orthogonal_lie_algebra
export standard_module
export symmetric_power
export symplectic_lie_algebra
export tensor_power
export tensor_product_decomposition
export trivial_module
export universal_enveloping_algebra
export weyl_group
export weyl_orbit
export word
export n_positive_roots # alias lives in a submodule
export n_roots # alias lives in a submodule
export n_simple_roots # alias lives in a submodule
6 changes: 3 additions & 3 deletions experimental/LieAlgebras/src/Util.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"""
coefficient_vector(M::MatElem{T}, basis::Vector{<:MatElem{T}}) where {T}
Oscar.LieAlgebras.coefficient_vector(M::MatElem{T}, basis::Vector{<:MatElem{T}}) where {T}
Return the vector of coefficients of the matrix `M` in the basis `basis`.
Requires that `basis` is linearly independent and that `M` lies in the span of `basis`.
# Examples
```jldoctest; setup = :(using Oscar.LieAlgebras)
julia> coefficient_vector(matrix(QQ, [1 2;3 4]), [matrix(QQ, [1 0;0 0]), matrix(QQ, [0 1;0 2]), matrix(QQ, [0 0;-1 0])])
```jldoctest
julia> Oscar.LieAlgebras.coefficient_vector(matrix(QQ, [1 2;3 4]), [matrix(QQ, [1 0;0 0]), matrix(QQ, [0 1;0 2]), matrix(QQ, [0 0;-1 0])])
[1 2 -3]
```
"""
Expand Down
Loading

0 comments on commit 224cb53

Please sign in to comment.