Skip to content

Commit

Permalink
fix symmetric and unitary
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszbaran committed Oct 1, 2024
1 parent 64dace5 commit 5e79c10
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
10 changes: 2 additions & 8 deletions src/manifolds/Symmetric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,7 @@ function get_coordinates_orthonormal!(M::SymmetricMatrices{<:Any,ℝ}, Y, p, X,
end
return Y
end
function get_coordinates_orthonormal!(
M::SymmetricMatrices{<:Any,ℂ},
Y,
p,
X,
::ComplexNumbers,
)
function get_coordinates_orthonormal!(M::SymmetricMatrices{<:Any,ℂ}, Y, p, X, ::RealNumbers)
N = get_parameter(M.size)[1]
dim = manifold_dimension(M)
@assert size(Y) == (dim,)
Expand Down Expand Up @@ -150,7 +144,7 @@ function get_vector_orthonormal!(M::SymmetricMatrices{<:Any,ℝ}, Y, p, X, ::Rea
end
return Y
end
function get_vector_orthonormal!(M::SymmetricMatrices{<:Any,ℂ}, Y, p, X, ::ComplexNumbers)
function get_vector_orthonormal!(M::SymmetricMatrices{<:Any,ℂ}, Y, p, X, ::RealNumbers)
N = get_parameter(M.size)[1]
dim = manifold_dimension(M)
@assert size(X) == (dim,)
Expand Down
4 changes: 2 additions & 2 deletions src/manifolds/Unitary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function get_coordinates_orthonormal(
::UnitaryMatrices{TypeParameter{Tuple{1}},ℍ},
p,
X::Quaternions.Quaternion,
::QuaternionNumbers,
::RealNumbers,
)
return @SVector [X.v1, X.v2, X.v3]
end
Expand All @@ -62,7 +62,7 @@ function get_vector_orthonormal(
::UnitaryMatrices{TypeParameter{Tuple{1}},ℍ},
p::Quaternions.Quaternion,
c,
::QuaternionNumbers,
::RealNumbers,
)
i = firstindex(c)
return Quaternions.quat(0, c[i], c[i + 1], c[i + 2])
Expand Down
4 changes: 2 additions & 2 deletions test/manifolds/symmetric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ include("../header.jl")
SchildsLadderTransport(),
PoleLadderTransport(),
],
basis_types_vecs=(DefaultOrthonormalBasis(),),
basis_types_to_from=(DefaultOrthonormalBasis(),),
basis_types_vecs=(DefaultOrthonormalBasis(),),
basis_types_to_from=(DefaultOrthonormalBasis(),),
is_tangent_atol_multiplier=1,
test_inplace=true,
)
Expand Down
6 changes: 3 additions & 3 deletions test/manifolds/unitary_matrices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@ end
@test is_point(M, q)
@test isapprox(q, sign(pu))

@test get_coordinates(M, p, Quaternion(0, 1, 2, 3), DefaultOrthonormalBasis()) ==
@test get_coordinates(M, p, Quaternion(0, 1, 2, 3), DefaultOrthonormalBasis()) ==
SA[1, 2, 3]
@test get_vector(M, p, SA[1, 2, 3], DefaultOrthonormalBasis()) ==
@test get_vector(M, p, SA[1, 2, 3], DefaultOrthonormalBasis()) ==
Quaternion(0, 1, 2, 3)

@test get_basis(M, p, DefaultOrthonormalBasis()).data == [
@test get_basis(M, p, DefaultOrthonormalBasis()).data == [
Quaternion(0.0, 1.0, 0.0, 0.0),
Quaternion(0.0, 0.0, 1.0, 0.0),
Quaternion(0.0, 0.0, 0.0, 1.0),
Expand Down

0 comments on commit 5e79c10

Please sign in to comment.