Skip to content

Commit

Permalink
fix a few bugs and increase test cov.
Browse files Browse the repository at this point in the history
  • Loading branch information
kellertuer committed Oct 30, 2024
1 parent 8b193eb commit 1e6dad6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
11 changes: 2 additions & 9 deletions src/group_operations/multiplication_operation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function diff_conjugate!(
) where {𝔽}
inv_right_compose!(G, Y, X, g) # Y = Xg^{-1}
compose!(G, Y, g, Y) # Y = gY
return copyto!(LieAlgebra(G), Y, X)
return Y
end

_doc_diff_inv_mult = """
Expand Down Expand Up @@ -324,19 +324,12 @@ function LinearAlgebra.mul!(
return copyto!(q, p)
end
function LinearAlgebra.mul!(
q::Union{AbstractMatrix,Number},
q::Union{AbstractMatrix},
::Identity{<:AbstractMultiplicationGroupOperation},
::Identity{<:AbstractMultiplicationGroupOperation},
)
return copyto!(q, I)
end
function LinearAlgebra.mul!(
q,
::Identity{<:AbstractMultiplicationGroupOperation},
::Identity{<:AbstractMultiplicationGroupOperation},
)
return copyto!(q, one(q))
end
function LinearAlgebra.mul!(
q::Identity{<:AbstractMultiplicationGroupOperation},
::Identity{<:AbstractMultiplicationGroupOperation},
Expand Down
26 changes: 21 additions & 5 deletions test/operations/test_multiplication_operation.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using LieGroups, Test
using LieGroups, LinearAlgebra, Test

s = joinpath(@__DIR__, "..", "LieGroupsTestSuite.jl")
!(s in LOAD_PATH) && (push!(LOAD_PATH, s))
Expand All @@ -23,12 +23,28 @@ using LieGroupsTestSuite
ea = Identity(AdditionGroupOperation)
@test ea * e === e
@test e * ea === e
# Zero array
g2 = fill(2.0, ())
# Array
g3 = [2.0 0.0; 0.0 2.0]
M = LieGroupsTestSuite.DummyManifold()
G = LieGroup(M, MatrixMultiplicationGroupOperation())
# Zero-dimensional array
g2 = fill(2.0, ())
X2 = fill(1.0, ())
@test diff_inv(G, g2, X2) == fill(-1.0, ())
# Array
g3 = [2.0 0.0; 1.0 2.0]
@test inv(G, e) === e
h3 = zero(g3)
X3 = [1.0 0.0; 0.0 2.0]
@test diff_conjugate(G, g3, g3, X3) = g3 * X3 * inv(g3)
# inplace-multiplication with e
h3 = zero(g3)
mul!(h3, e, g3)
@test h3 == g3
h3 = zero(g3)
mul!(h3, g3, e)
@test h3 == g3
mul!(h3, e, e)
@test h3 == I
@test mul!(e, e, e) === e
@test one(e) === e
end
end

0 comments on commit 1e6dad6

Please sign in to comment.