Skip to content

Commit efc8010

Browse files
authored
Fix retarction with t on power manifold (#175)
* define t-specialisations on retractions for power manifolds. * write a news entry. * Simplify code, add tests for t-retractions on power manifolds. * runs formatter. * Bump version.
1 parent 81d2d93 commit efc8010

File tree

4 files changed

+48
-1
lines changed

4 files changed

+48
-1
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.4] 25/11/2023
9+
10+
### Fixed
11+
12+
* Fixed a bug reported in [Manopt#330](https://github.com/JuliaManifolds/Manopt.jl/issues/330).
13+
814
## [0.15.3] 17/11/2023
915

1016
### Fixed

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.3"
4+
version = "0.15.4"
55

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

src/PowerManifold.jl

+37
Original file line numberDiff line numberDiff line change
@@ -1291,6 +1291,43 @@ function retract!(
12911291
return q
12921292
end
12931293

1294+
function retract!(
1295+
M::AbstractPowerManifold,
1296+
q,
1297+
p,
1298+
X,
1299+
t::Number,
1300+
m::AbstractRetractionMethod = default_retraction_method(M, typeof(p)),
1301+
)
1302+
rep_size = representation_size(M.manifold)
1303+
for i in get_iterator(M)
1304+
retract!(
1305+
M.manifold,
1306+
_write(M, rep_size, q, i),
1307+
_read(M, rep_size, p, i),
1308+
_read(M, rep_size, X, i),
1309+
t,
1310+
m,
1311+
)
1312+
end
1313+
return q
1314+
end
1315+
function retract!(
1316+
M::PowerManifoldNestedReplacing,
1317+
q,
1318+
p,
1319+
X,
1320+
t::Number,
1321+
m::AbstractRetractionMethod = default_retraction_method(M, typeof(p)),
1322+
)
1323+
rep_size = representation_size(M.manifold)
1324+
for i in get_iterator(M)
1325+
q[i...] =
1326+
retract(M.manifold, _read(M, rep_size, p, i), _read(M, rep_size, X, i), t, m)
1327+
end
1328+
return q
1329+
end
1330+
12941331
@doc raw"""
12951332
riemann_tensor(M::AbstractPowerManifold, p, X, Y, Z)
12961333

test/power.jl

+4
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ struct TestArrayRepresentation <: AbstractPowerRepresentation end
141141
@test retract(N, p, q, ExponentialRetraction()) == p .+ q
142142
r = allocate(p)
143143
@test retract!(N, r, p, q, ExponentialRetraction()) == p .+ q
144+
@test retract(N, p, q, 1.0) == p .+ q
145+
@test retract(N, p, q, 1.0, ExponentialRetraction()) == p .+ q
146+
r = allocate(p)
147+
@test retract!(N, r, p, q, 1.0, ExponentialRetraction()) == p .+ q
144148
@test r == p .+ q
145149
@test inverse_retract(N, p, r) == q
146150
@test inverse_retract(N, p, r, LogarithmicInverseRetraction()) == q

0 commit comments

Comments
 (0)