From 9881f73a46ad552fcdd499896713ba7eed19415b Mon Sep 17 00:00:00 2001 From: Ronny Bergmann Date: Sun, 25 Aug 2024 18:56:35 +0200 Subject: [PATCH] Move product manifold on alternating gradient to a new extension. --- Project.toml | 3 ++- docs/Project.toml | 1 + ext/ManoptManifoldsExt/ManoptManifoldsExt.jl | 5 ----- ...ent.jl => ManoptRecursiveArrayToolsExt.jl} | 19 +++++++++++++++++++ tutorials/Project.toml | 1 + 5 files changed, 23 insertions(+), 6 deletions(-) rename ext/{ManoptManifoldsExt/alternating_gradient.jl => ManoptRecursiveArrayToolsExt.jl} (89%) diff --git a/Project.toml b/Project.toml index 6f79edc6e7..5d21ee3b6a 100644 --- a/Project.toml +++ b/Project.toml @@ -34,7 +34,8 @@ RipQP = "1e40b3f8-35eb-4cd8-8edd-3e515bb9de08" ManoptJuMPExt = "JuMP" ManoptLRUCacheExt = "LRUCache" ManoptLineSearchesExt = "LineSearches" -ManoptManifoldsExt = ["Manifolds", "RecursiveArrayTools"] +ManoptManifoldsExt = "Manifolds" +ManoptRecursiveArrayToolsExt = "RecursiveArrayTools" ManoptRipQPQuadraticModelsExt = ["RipQP", "QuadraticModels"] [compat] diff --git a/docs/Project.toml b/docs/Project.toml index b10bf8f1b5..3b49f7d709 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -21,6 +21,7 @@ Manopt = "0fc0a36d-df90-57f3-8f93-d78a9fc72bb5" Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" QuadraticModels = "f468eda6-eac5-11e8-05a5-ff9e497bcd19" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" +RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" RipQP = "1e40b3f8-35eb-4cd8-8edd-3e515bb9de08" [compat] diff --git a/ext/ManoptManifoldsExt/ManoptManifoldsExt.jl b/ext/ManoptManifoldsExt/ManoptManifoldsExt.jl index dfdea056ba..405c299111 100644 --- a/ext/ManoptManifoldsExt/ManoptManifoldsExt.jl +++ b/ext/ManoptManifoldsExt/ManoptManifoldsExt.jl @@ -5,8 +5,6 @@ using Manopt using Manopt: _tex, _var, ManifoldDefaultsFactory, _produce_type import Manopt: max_stepsize, - alternating_gradient_descent, - alternating_gradient_descent!, get_gradient, get_gradient!, set_parameter!, @@ -23,10 +21,8 @@ using ManifoldDiff: if isdefined(Base, :get_extension) using Manifolds - using RecursiveArrayTools else using ..Manifolds - using ..RecursiveArrayTools end Rn(::Val{:Manifolds}, args...; kwargs...) = Euclidean(args...; kwargs...) @@ -34,5 +30,4 @@ Rn(::Val{:Manifolds}, args...; kwargs...) = Euclidean(args...; kwargs...) const NONMUTATINGMANIFOLDS = Union{Circle,PositiveNumbers,Euclidean{Tuple{}}} include("manifold_functions.jl") include("ChambollePockManifolds.jl") -include("alternating_gradient.jl") end diff --git a/ext/ManoptManifoldsExt/alternating_gradient.jl b/ext/ManoptRecursiveArrayToolsExt.jl similarity index 89% rename from ext/ManoptManifoldsExt/alternating_gradient.jl rename to ext/ManoptRecursiveArrayToolsExt.jl index 0b77e35c72..aa627e7923 100644 --- a/ext/ManoptManifoldsExt/alternating_gradient.jl +++ b/ext/ManoptRecursiveArrayToolsExt.jl @@ -1,3 +1,21 @@ +module ManoptRecursiveArrayToolsExt +using Manopt +using ManifoldsBase +using ManifoldsBase: submanifold_components +import Manopt: + max_stepsize, + alternating_gradient_descent, + alternating_gradient_descent!, + get_gradient, + get_gradient!, + set_parameter! +using Manopt: _tex, _var, ManifoldDefaultsFactory, _produce_type + +if isdefined(Base, :get_extension) + using RecursiveArrayTools +else + using ..RecursiveArrayTools +end @doc raw""" X = get_gradient(M::ProductManifold, ago::ManifoldAlternatingGradientObjective, p) @@ -112,3 +130,4 @@ function alternating_gradient_descent!( Manopt.solve!(dmp, agds) return Manopt.get_solver_return(get_objective(dmp), agds) end +end diff --git a/tutorials/Project.toml b/tutorials/Project.toml index b9002507a9..4930095aec 100644 --- a/tutorials/Project.toml +++ b/tutorials/Project.toml @@ -10,6 +10,7 @@ Manifolds = "1cead3c2-87b3-11e9-0ccd-23c62b72b94e" ManifoldsBase = "3362f125-f0bb-47a3-aa74-596ffd7ef2fb" Manopt = "0fc0a36d-df90-57f3-8f93-d78a9fc72bb5" Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" +RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" [compat] BenchmarkTools = "1"