Skip to content

Commit ecebd94

Browse files
authored
Better support for custom point types in conjugate_gradient_descent (#596)
1 parent e34397f commit ecebd94

4 files changed

Lines changed: 18 additions & 4 deletions

File tree

Changelog.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,18 @@ The file was started with Version `0.4`.
66
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
77
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
88

9-
## [0.5.35] April 3, 2026
9+
## [0.5.35] April 16, 2026
1010

1111
### Changed
1212

1313
* Improved formatting of the references in the Readme.md (#586)
1414
* Bump compat for RecursiveArrayTools.jl to include version 4
1515
* deactivate CompatHelper Action and solely use dependabot
1616

17+
### Fixed
18+
19+
* The default line search in `conjugate_gradient_descent` is now `ArmijoLinesearchStepsize` instead of `ArmijoLinesearch`, which makes it work well with custom point types.
20+
1721
## [0.5.34] March 3, 2026
1822

1923
### Fixed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "Manopt"
22
uuid = "0fc0a36d-df90-57f3-8f93-d78a9fc72bb5"
3-
version = "0.5.34"
3+
version = "0.5.35"
44
authors = [{family-names = "Bergmann", given-names = "Ronny", alias = "kellertuer", city = "Trondheim", affiliation = "Norwegian University of Science and Technology", country = "NO", email = "manopt@ronnybergmann.net", orcid = "https://orcid.org/0000-0001-8342-7218", website = "https://ronnybergmann.net"}]
55

66
[workspace]

src/solvers/conjugate_gradient_descent.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function default_stepsize(
44
retraction_method = default_retraction_method(M),
55
)
66
# take a default with a slightly defensive initial step size.
7-
return ArmijoLinesearchStepsize(
7+
return ArmijoLinesearch(
88
M; retraction_method = retraction_method, initial_stepsize = 1.0
99
)
1010
end

test/solvers/test_conjugate_gradient.jl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Manopt, Manifolds, ManifoldsBase, Test, Random, LinearAlgebra
22
using LinearAlgebra: Diagonal, dot, eigvals, eigvecs
3+
using ManifoldDiff: grad_distance
34

45
@testset "Conjugate Gradient Descent" begin
56
@testset "Conjugate Gradient coefficient rules" begin
@@ -31,7 +32,7 @@ using LinearAlgebra: Diagonal, dot, eigvals, eigvecs
3132
initial_gradient = zero_vector(M, x0),
3233
)
3334
@test s1.coefficient(dmp, s1, 1) == 0
34-
@test default_stepsize(M, typeof(s1)) isa Manopt.ArmijoLinesearchStepsize
35+
@test default_stepsize(M, typeof(s1)) isa Manopt.ManifoldDefaultsFactory{Manopt.ArmijoLinesearchStepsize}
3536
@test Manopt.get_message(s1) == ""
3637

3738
dU = Manopt.ConjugateDescentCoefficient()
@@ -394,4 +395,13 @@ using LinearAlgebra: Diagonal, dot, eigvals, eigvecs
394395
)
395396
@test q2 [1, 0, 0] rtol = 1.0e-7
396397
end
398+
399+
@testset "Custom point types" begin
400+
M = Hyperbolic(2)
401+
data = PoincareBallPoint.([[0.1, 0.2], [0.3, 0.25], [0.35, 0.4]])
402+
n = length(data)
403+
f(M, p) = sum(1 / (2 * n) * distance.(Ref(M), Ref(p), data) .^ 2)
404+
grad_f(M, p) = sum(1 / n * grad_distance.(Ref(M), data, Ref(p)))
405+
@test conjugate_gradient_descent(M, f, grad_f, data[1]) isa PoincareBallPoint
406+
end
397407
end

0 commit comments

Comments
 (0)