Skip to content

Commit

Permalink
Starts testing mult op.
Browse files Browse the repository at this point in the history
  • Loading branch information
kellertuer committed Oct 30, 2024
1 parent 827b1fd commit e9a90b7
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/group_operations/multiplication_operation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ A group operation that is realised by a matrix multiplication.
struct MatrixMultiplicationGroupOperation <: AbstractMultiplicationGroupOperation end

Base.:*(e::Identity{<:AbstractMultiplicationGroupOperation}) = e
Base.:*(::Identity{MatrixMultiplicationGroupOperation}, p::AbstractMatrix) = p
Base.:*(p::AbstractMatrix, ::Identity{MatrixMultiplicationGroupOperation}) = p
Base.:*(::Identity{MatrixMultiplicationGroupOperation}, p::Union{AbstractMatrix,Number}) = p
function Base.:*(
p::Union{AbstractMatrix,Number}, ::Identity{MatrixMultiplicationGroupOperation}
)
return p
end
function Base.:*(
e::Identity{<:AbstractMultiplicationGroupOperation},
::Identity{<:AbstractMultiplicationGroupOperation},
Expand Down
19 changes: 19 additions & 0 deletions test/operations/test_multiplication_operation.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using LieGroups, Test

@testset "Addition Operation" begin
@testset "Base.:+ and Base.:- with the Identity" begin
e = Identity(MatrixMultiplicationGroupOperation())
@test (e * e) === e
g = 2
@test (g * e) == g
@test (e * g) == g
@test (g / e) == g
@test (e \ g) == g
@test (e / g) == 1 / g
@test (g \ e) == 1 / g
@test (e / e) === e
@test (e \ e) === e
@test inv(e) === e
@test det(e)
end
end
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ end
end
@testset "Generic Group Operations" begin
include_test("operations/test_addidion_operation.jl")
include_test("operations/test_multiplication_operation.jl")
end
@testset "Generic Group Actions" begin
include_test("actions/test_action_interface.jl")
Expand Down

0 comments on commit e9a90b7

Please sign in to comment.