Skip to content

Commit

Permalink
Move is_fundamental_weight from BLHW
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens committed Nov 19, 2024
1 parent 3b2fd6a commit f5ca39c
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 25 deletions.
18 changes: 1 addition & 17 deletions experimental/BasisLieHighestWeight/src/MainAlgorithm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ function compute_monomials(
# if highest_weight is not a fundamental weight, partition into smaller summands is possible. This is the basecase of
# the recursion.
dim = dim_of_simple_module(L, highest_weight)
if is_zero(highest_weight) || is_fundamental(highest_weight)
if is_zero(highest_weight) || is_fundamental_weight(highest_weight)
push!(no_minkowski, highest_weight)
monomials = add_by_hand(
L, birational_seq, ZZx, highest_weight, monomial_ordering, Set{ZZMPolyRingElem}()
Expand Down Expand Up @@ -473,22 +473,6 @@ function operators_lusztig(L::LieAlgebra, reduced_expression::Vector{Int})
return operators
end

# TODO: upstream to LieAlgebras/RootSystem.jl
function is_fundamental(highest_weight::WeightLatticeElem)
hasone = false
for i in coefficients(highest_weight)
if iszero(i)
continue
elseif isone(i)
hasone && return false
hasone = true
else
return false
end
end
return hasone
end

function sub_weights(w::WeightLatticeElem)
# returns list of weights v != 0, highest_weight with 0 <= v <= w elementwise
@req is_dominant(w) "The input must be a dominant weight"
Expand Down
6 changes: 0 additions & 6 deletions experimental/BasisLieHighestWeight/test/MainAlgorithm-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ function check_dimension(
@test gap_dim == dim(basis) == length(monomials(basis)) # check if dimension is correct
end

@testset "is_fundamental" begin
R = root_system(:B, 3)
@test BasisLieHighestWeight.is_fundamental(WeightLatticeElem(R, [ZZ(0), ZZ(1), ZZ(0)]))
@test !BasisLieHighestWeight.is_fundamental(WeightLatticeElem(R, [ZZ(0), ZZ(1), ZZ(1)]))
end

@testset "sub_weights(_proper)" begin
sub_weights = BasisLieHighestWeight.sub_weights
sub_weights_proper = BasisLieHighestWeight.sub_weights_proper
Expand Down
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 @@ -205,6 +205,8 @@ coefficients(::WeightLatticeElem)
```@docs
iszero(::WeightLatticeElem)
is_dominant(::WeightLatticeElem)
is_fundamental_weight(::WeightLatticeElem)
is_fundamental_weight_with_index(::WeightLatticeElem)
```

### Reflections
Expand Down
37 changes: 37 additions & 0 deletions experimental/LieAlgebras/src/RootSystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1695,6 +1695,43 @@ function is_dominant(w::WeightLatticeElem)
return all(>=(0), coefficients(w))
end

@doc raw"""
is_fundamental_weight(w::WeightLatticeElem) -> Bool
Check if `w` is a fundamental weight, i.e. exactly one coefficient is equal to 1 and all others are zero.
See also: [`is_fundamental_weight_with_index(::WeightLatticeElem)`](@ref).
"""
function is_fundamental_weight(w::WeightLatticeElem)
fl, _ = is_fundamental_weight_with_index(w)
return fl
end

@doc raw"""
is_fundamental_weight_with_index(w::WeightLatticeElem) -> Bool, Int
Check if `w` is a fundamental weight and return this together with the index of the fundamental weight in [`fundamental_weights(::RootSystem)`](@ref fundamental_weights(root_system(w))).
If `w` is not a fundamental weight, the second return value is arbitrary.
See also: [`is_fundamental_weight(::WeightLatticeElem)`](@ref).
"""
function is_fundamental_weight_with_index(w::WeightLatticeElem)
ind = 0
coeffs = coefficients(w)
for i in 1:size(coeffs, 2)
if is_zero_entry(coeffs, 1, i)
continue
elseif is_one(coeffs[1, i])
ind != 0 && return false, 0
ind = i
else
return false, 0
end
end
return ind != 0, ind
end

@doc raw"""
reflect(w::WeightLatticeElem, s::Int) -> WeightLatticeElem
Expand Down
2 changes: 2 additions & 0 deletions experimental/LieAlgebras/src/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ export is_cartan_type
export is_coroot
export is_coroot_with_index
export is_dominant
export is_fundamental_weight
export is_fundamental_weight_with_index
export is_negative_coroot
export is_negative_coroot_with_index
export is_negative_root
Expand Down
13 changes: 11 additions & 2 deletions experimental/LieAlgebras/test/RootSystem-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
@test all(i -> negative_root(R, i) == negative_roots(R)[i], 1:npositive_roots)
@test simple_roots(R) == positive_roots(R)[1:rk]
@test all(is_root, roots(R))
n_roots(R) >= 1 && @test !is_root(root(R, 1) - root(R, 1))
@test !is_root(zero(RootSpaceElem, R))
@test all(r -> !is_root(2 * r), roots(R))
@test all(is_root_with_index(r) == (true, i) for (i, r) in enumerate(roots(R)))
@test all(r -> is_positive_root(r) == is_positive_root_with_index(r)[1], roots(R))
Expand Down Expand Up @@ -94,7 +94,7 @@
@test all(i -> negative_coroot(R, i) == negative_coroots(R)[i], 1:npositive_roots)
@test simple_coroots(R) == positive_coroots(R)[1:rk]
@test all(is_coroot, coroots(R))
n_roots(R) >= 1 && @test !is_coroot(coroot(R, 1) - coroot(R, 1))
@test !is_coroot(zero(DualRootSpaceElem, R))
@test all(r -> !is_coroot(2 * r), coroots(R))
@test all(is_coroot_with_index(r) == (true, i) for (i, r) in enumerate(coroots(R)))
@test all(
Expand Down Expand Up @@ -134,6 +134,15 @@
@test length(fundamental_weights(R)) == rank(R)
@test all(i -> fundamental_weight(R, i) == fundamental_weights(R)[i], 1:rk)
@test all(w -> w == WeightLatticeElem(RootSpaceElem(w)), fundamental_weights(R))
@test all(is_fundamental_weight, fundamental_weights(R))
@test all(
is_fundamental_weight_with_index(w) == (true, i) for (i, w) in
enumerate(fundamental_weights(R))
)
@test !is_fundamental_weight(zero(WeightLatticeElem, R))
rk != 1 && @test !is_fundamental_weight(
sum(fundamental_weights(R); init=zero(WeightLatticeElem, R))
)
@test all(
dot(simple_root(R, i), fundamental_weight(R, j)) ==
(i == j ? cartan_symmetrizer(R)[i] : 0) for i in 1:rk, j in 1:rk
Expand Down

0 comments on commit f5ca39c

Please sign in to comment.