Skip to content

Commit 4332265

Browse files
authored
Make vee and hat always use real coefficient basis (#173)
1 parent eebe99d commit 4332265

File tree

4 files changed

+31
-13
lines changed

4 files changed

+31
-13
lines changed

NEWS.md

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.15.2] 8/11/2023
9+
10+
### Fixed
11+
12+
- `vee` and `hat` now use real coefficient basis for complex manifolds.
13+
814
## [0.15.1] 30/10/2023
915

1016
### Added

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ManifoldsBase"
22
uuid = "3362f125-f0bb-47a3-aa74-596ffd7ef2fb"
33
authors = ["Seth Axen <[email protected]>", "Mateusz Baran <[email protected]>", "Ronny Bergmann <[email protected]>", "Antoine Levitt <[email protected]>"]
4-
version = "0.15.1"
4+
version = "0.15.2"
55

66
[deps]
77
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

src/bases.jl

+17-12
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ GramSchmidtOrthonormalBasis(𝔽::AbstractNumbers = ℝ) = GramSchmidtOrthonorma
215215
216216
An orthonormal basis `Ξ` as a vector of tangent vectors (of length determined by
217217
[`manifold_dimension`](@ref)) in the tangent space that diagonalizes the curvature
218-
tensor $R(u,v)w$ and where the direction `frame_direction` $v$ has curvature `0`.
218+
tensor ``R(u,v)w`` and where the direction `frame_direction` ``v`` has curvature `0`.
219219
220220
The type parameter `𝔽` denotes the [`AbstractNumbers`](@ref) that will be used
221221
for the vectors elements.
@@ -373,8 +373,8 @@ end
373373
374374
Get the dual basis to `B`, a basis of a vector space at point `p` from manifold `M`.
375375
376-
The dual to the $i$th vector $v_i$ from basis `B` is a vector $v^i$ from the dual space
377-
such that $v^i(v_j) = δ^i_j$, where $δ^i_j$ is the Kronecker delta symbol:
376+
The dual to the ``i``th vector ``v_i`` from basis `B` is a vector ``v^i`` from the dual space
377+
such that ``v^i(v_j) = δ^i_j``, where ``δ^i_j`` is the Kronecker delta symbol:
378378
````math
379379
δ^i_j = \begin{cases}
380380
1 & \text{ if } i=j, \\
@@ -920,9 +920,9 @@ end
920920
@doc raw"""
921921
hat(M::AbstractManifold, p, Xⁱ)
922922
923-
Given a basis $e_i$ on the tangent space at a point `p` and tangent
924-
component vector $X^i$, compute the equivalent vector representation
925-
$X=X^i e_i$, where Einstein summation notation is used:
923+
Given a basis ``e_i`` on the tangent space at a point `p` and tangent
924+
component vector ``X^i ∈ ℝ``, compute the equivalent vector representation
925+
``X=X^i e_i``, where Einstein summation notation is used:
926926
927927
````math
928928
∧ : X^i ↦ X^i e_i
@@ -932,8 +932,10 @@ For array manifolds, this converts a vector representation of the tangent
932932
vector to an array representation. The [`vee`](@ref) map is the `hat` map's
933933
inverse.
934934
"""
935-
@inline hat(M::AbstractManifold, p, X) = get_vector(M, p, X, VeeOrthogonalBasis())
936-
@inline hat!(M::AbstractManifold, Y, p, X) = get_vector!(M, Y, p, X, VeeOrthogonalBasis())
935+
@inline hat(M::AbstractManifold, p, X) =
936+
get_vector(M, p, X, VeeOrthogonalBasis(number_system(M)))
937+
@inline hat!(M::AbstractManifold, Y, p, X) =
938+
get_vector!(M, Y, p, X, VeeOrthogonalBasis(number_system(M)))
937939

938940
"""
939941
number_of_coordinates(M::AbstractManifold{𝔽}, B::AbstractBasis)
@@ -1063,8 +1065,8 @@ end
10631065
@doc raw"""
10641066
vee(M::AbstractManifold, p, X)
10651067
1066-
Given a basis $e_i$ on the tangent space at a point `p` and tangent
1067-
vector `X`, compute the vector components $X^i$, such that $X = X^i e_i$, where
1068+
Given a basis ``e_i`` on the tangent space at a point `p` and tangent
1069+
vector `X`, compute the vector components ``X^i ∈ ℝ``, such that ``X = X^i e_i``, where
10681070
Einstein summation notation is used:
10691071
10701072
````math
@@ -1075,5 +1077,8 @@ For array manifolds, this converts an array representation of the tangent
10751077
vector to a vector representation. The [`hat`](@ref) map is the `vee` map's
10761078
inverse.
10771079
"""
1078-
vee(M::AbstractManifold, p, X) = get_coordinates(M, p, X, VeeOrthogonalBasis())
1079-
vee!(M::AbstractManifold, Y, p, X) = get_coordinates!(M, Y, p, X, VeeOrthogonalBasis())
1080+
vee(M::AbstractManifold, p, X) =
1081+
get_coordinates(M, p, X, VeeOrthogonalBasis(number_system(M)))
1082+
function vee!(M::AbstractManifold, Y, p, X)
1083+
return get_coordinates!(M, Y, p, X, VeeOrthogonalBasis(number_system(M)))
1084+
end

test/default_manifold.jl

+7
Original file line numberDiff line numberDiff line change
@@ -880,4 +880,11 @@ Base.size(x::MatrixVectorTransport) = (size(x.m, 2),)
880880
@test repr(MS) == "DefaultManifold(3; field = ℝ, parameter = :type)"
881881
@test_throws ArgumentError ManifoldsBase.DefaultManifold(3; parameter = :foo)
882882
end
883+
884+
@testset "complex vee and hat" begin
885+
MC = ManifoldsBase.DefaultManifold(3; field = ManifoldsBase.ℂ)
886+
p = [1im, 2 + 2im, 3.0]
887+
@test isapprox(vee(MC, p, [1 + 2im, 3 + 4im, 5 + 6im]), [1, 3, 5, 2, 4, 6])
888+
@test isapprox(hat(MC, p, [1, 3, 5, 2, 4, 6]), [1 + 2im, 3 + 4im, 5 + 6im])
889+
end
883890
end

0 commit comments

Comments
 (0)