-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
flat!, sharp! and optimized inner of cotangent vectors for metric man…
…ifolds
- Loading branch information
1 parent
b0faa70
commit ea6ef68
Showing
3 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -144,6 +144,21 @@ end | |
return inner(M.manifold, x, v, w) | ||
end | ||
|
||
@traitfn function inner(B::VectorBundleFibers{<:CotangentSpaceType, MMT}, x, v, w) where {MT<:Manifold, | ||
GT<:Metric, | ||
MMT<:MetricManifold{MT,GT}; | ||
!HasMetric{MT,GT}} | ||
ginv = inverse_local_metric(B.M, x) | ||
return dot(ginv * v, ginv * w) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
mateuszbaran
Author
Member
|
||
end | ||
|
||
@traitfn function inner(B::VectorBundleFibers{<:CotangentSpaceType, MMT}, x, v, w) where {MT<:Manifold, | ||
GT<:Metric, | ||
MMT<:MetricManifold{MT,GT}; | ||
HasMetric{MT,GT}} | ||
return inner(VectorBundleFibers(B.VS, B.M.manifold), x, v, w) | ||
end | ||
|
||
@traitfn function norm(M::MMT, x, v) where {MT<:Manifold, | ||
GT<:Metric, | ||
MMT<:MetricManifold{MT,GT}; | ||
|
@@ -457,3 +472,47 @@ end | |
HasMetric{MT,GT}} | ||
return is_tangent_vector(M.manifold, x, v; kwargs...) | ||
end | ||
|
||
@traitfn function flat!(M::MMT, | ||
v::FVector{CotangentSpaceType}, | ||
x, | ||
w::FVector{TangentSpaceType}) where {MT<:Manifold, | ||
GT<:Metric, | ||
MMT<:MetricManifold{MT,GT}; | ||
!HasMetric{MT,GT}} | ||
g = local_metric(M, x) | ||
copyto!(v, g*w) | ||
return v | ||
end | ||
|
||
@traitfn function flat!(M::MMT, | ||
v::FVector{CotangentSpaceType}, | ||
x, | ||
w::FVector{TangentSpaceType}) where {MT<:Manifold, | ||
GT<:Metric, | ||
MMT<:MetricManifold{MT,GT}; | ||
HasMetric{MT,GT}} | ||
return flat!(M.manifold, v, x, w) | ||
end | ||
|
||
@traitfn function sharp!(M::MMT, | ||
v::FVector{TangentSpaceType}, | ||
x, | ||
w::FVector{CotangentSpaceType}) where {MT<:Manifold, | ||
GT<:Metric, | ||
MMT<:MetricManifold{MT,GT}; | ||
!HasMetric{MT,GT}} | ||
ginv = inverse_local_metric(M, x) | ||
copyto!(v, ginv*w) | ||
return v | ||
end | ||
|
||
@traitfn function sharp!(M::MMT, | ||
v::FVector{TangentSpaceType}, | ||
x, | ||
w::FVector{CotangentSpaceType}) where {MT<:Manifold, | ||
GT<:Metric, | ||
MMT<:MetricManifold{MT,GT}; | ||
HasMetric{MT,GT}} | ||
return flat!(M.manifold, v, x, w) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I don't think this is correct. It should be
v' * ginv * W
. I'm working on a 3-argdot
in Julia.Base. JuliaLang/julia#32739 With that one, it would bedot(v, ginv, w)
.