From 85c1a64c5e53481ea6ac1952a01ad2c22f457949 Mon Sep 17 00:00:00 2001 From: Ronny Bergmann Date: Mon, 30 Dec 2024 13:55:02 +0100 Subject: [PATCH] Add a test for the new factory. --- .../test_nonlinear_least_squares_plan.jl | 25 +++++++++++++++++++ test/runtests.jl | 1 + 2 files changed, 26 insertions(+) create mode 100644 test/plans/test_nonlinear_least_squares_plan.jl diff --git a/test/plans/test_nonlinear_least_squares_plan.jl b/test/plans/test_nonlinear_least_squares_plan.jl new file mode 100644 index 0000000000..9fa5bec20e --- /dev/null +++ b/test/plans/test_nonlinear_least_squares_plan.jl @@ -0,0 +1,25 @@ +using Manifolds, Manopt, Test + +@testset "Nonlinear lest squares plane" begin + @testset "Test cost/residual/jacobian cases with smoothing" begin end + @testset "Smootthing factory" begin + s1 = Manopt.smoothing_factory(:Identity) + @test s1 isa ManifoldHessianObjective + + s2 = Manopt.smoothing_factory((:Identity, 2)) + @test s2 isa VectorHessianFunction + @test length(s2) == 2 + + s3 = Manopt.smoothing_factory((:Identity, 3.0)) + @test s3 isa ManifoldHessianObjective + + for s in [:Arctan, :Cauchy, :Huber, :SoftL1, :Tukey] + s4 = Manopt.smoothing_factory(s) + @test s4 isa ManifoldHessianObjective + end + + s5 = Manopt.smoothing_factory(((:Identity, 2), (:Huber, 3))) + @test s5 isa VectorHessianFunction + @test length(s5) == 5 + end +end diff --git a/test/runtests.jl b/test/runtests.jl index 3d90036bcb..80947d9fa1 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -16,6 +16,7 @@ include("utils/example_tasks.jl") include("plans/test_conjugate_residual_plan.jl") include("plans/test_interior_point_newton_plan.jl") include("plans/test_nelder_mead_plan.jl") + include("plans/test_nonlinear_least_squares_plan.jl") include("plans/test_gradient_plan.jl") include("plans/test_constrained_plan.jl") include("plans/test_hessian_plan.jl")