Skip to content

Commit 5b688ab

Browse files
committed
add tests
1 parent de1284f commit 5b688ab

File tree

8 files changed

+58
-3
lines changed

8 files changed

+58
-3
lines changed

docs/src/groups/lie.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ ScalingLieGroup
1414
LieGroup
1515
```
1616

17+
!!! note
18+
Supported Lie group types and sizes: SO(3).
19+
1720
## Lie algebras
1821

1922
```@docs

src/lie-groups/lie-algebras/weights/weight-space.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export WeightSpace,
2+
weight,
23
space
34

45
struct WeightSpace{T<:AbstractSpace, W<:Weight}

src/lie-groups/lie-algebras/weights/weight-struct.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
export WeightStructure,
2+
weights,
3+
nweights,
24
weight_space,
35
sym
46

src/lie-groups/lie-algebras/weights/weight.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Base.getindex(w::Weight, i::Integer) = w.weight[i]
1919
Base.getindex(w::Weight, inds...) = getindex(w.weight, inds...)
2020
Base.length(w::Weight) = length(w.weight)
2121
Base.eachindex(w::Weight) = eachindex(w.weight)
22+
Base.iterate(w::Weight) = iterate(w.weight)
23+
Base.iterate(w::Weight, state) = iterate(w.weight, state)
2224

2325
function str_irr(V::String, w::Weight)
2426
return V * vec_subscript(w.weight)

src/lie-groups/lie-groups/groups.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ Describes a matrix Lie group.
7676
LieGroup(type::String, size::Int)
7777
```
7878
79-
Supported Lie group types: SO (special orthogonal).
80-
8179
# Examples
8280
```jldoctest
8381
julia> SO3 = LieGroup("SO", 3)

test/lie-algebras.jl

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@testset "Lie algebras" begin
2+
@testset "LieAlgebra" begin
3+
so3 = algebra(LieGroup("SO", 3))
4+
@test size(so3) == 3
5+
@test dim(so3) == 3
6+
@test rank(so3) == 1
7+
@test nweights(so3) == 3
8+
end
9+
10+
@testset "ScalingLieAlgebra" begin
11+
T = algebra(ScalingLieGroup([1 2 3 4; -1 -2 -3 -4]))
12+
@test size(T) == 4
13+
@test dim(T) == 2
14+
@test rank(T) == 2
15+
end
16+
17+
@testset "Predefined weight structure of Lie algebra" begin
18+
so3 = algebra(LieGroup("SO", 3))
19+
ws = weight_structure(so3)
20+
cartan = cartan_subalgebra(so3)
21+
for wsp in ws
22+
for (Jel, λ) in zip(cartan, weight(wsp))
23+
Jm = matrix(Jel)
24+
@test Jm isa Matrix{ComplexF64}
25+
@test size(Jm) == (3, 3)
26+
for wv in wsp
27+
v = vector(wv)
28+
@test v isa Vector{ComplexF64}
29+
@test length(v) == 3
30+
@test Jm * vector(wv) λ * vector(wv)
31+
end
32+
end
33+
end
34+
end
35+
end

test/lie-groups.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@testset "Lie groups" begin
2+
@testset "LieGroup" begin
3+
SO3 = LieGroup("SO", 3)
4+
@test SO3 isa LieGroup{ComplexF64}
5+
@test algebra(SO3) isa LieAlgebra{ComplexF64, Weight{Int}}
6+
end
7+
8+
@testset "ScalingLieGroup" begin
9+
T = ScalingLieGroup([1 2 3 4; -1 -2 -3 -4])
10+
@test T isa ScalingLieGroup{ComplexF64}
11+
@test algebra(T) isa ScalingLieAlgebra{ComplexF64}
12+
end
13+
end

test/runtests.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ using DecomposingGroupRepresentations
22
using Test
33

44
@testset "DecomposingGroupRepresentations.jl" begin
5-
5+
include("lie-groups.jl")
6+
include("lie-algebras.jl")
67
end

0 commit comments

Comments
 (0)