From e3fd23a0dfc8456a5a2f22c75eb80f957db7433d Mon Sep 17 00:00:00 2001 From: Ronny Bergmann Date: Tue, 17 Oct 2023 15:01:30 +0200 Subject: [PATCH 1/8] Fix errors that changed in type. --- test/manifolds/centered_matrices.jl | 2 +- test/manifolds/fixed_rank.jl | 2 +- test/manifolds/probability_simplex.jl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/manifolds/centered_matrices.jl b/test/manifolds/centered_matrices.jl index 3113febd70..ae63d1f5f9 100644 --- a/test/manifolds/centered_matrices.jl +++ b/test/manifolds/centered_matrices.jl @@ -19,7 +19,7 @@ include("../utils.jl") @test_throws DomainError is_point(M, D; error=:error) @test check_vector(M, A, A) === nothing @test_throws DomainError is_vector(M, A, D; error=:error) - @test_throws ManifoldDomainError is_vector(M, D, A; error=:error) + @test_throws DomainError is_vector(M, D, A; error=:error) @test_throws ManifoldDomainError is_vector(M, A, B; error=:error) @test manifold_dimension(M) == 4 @test A == project!(M, A, A) diff --git a/test/manifolds/fixed_rank.jl b/test/manifolds/fixed_rank.jl index 71c083bd5e..f779c06444 100644 --- a/test/manifolds/fixed_rank.jl +++ b/test/manifolds/fixed_rank.jl @@ -68,7 +68,7 @@ include("../utils.jl") UMVTVector(zeros(2, 1), zeros(1, 2), zeros(2, 2)), ) @test !is_vector(M, SVDMPoint([1.0 0.0; 0.0 0.0], 2), X) - @test_throws ManifoldDomainError is_vector( + @test_throws DomainError is_vector( M, SVDMPoint([1.0 0.0; 0.0 0.0], 2), X; diff --git a/test/manifolds/probability_simplex.jl b/test/manifolds/probability_simplex.jl index f0d99d2e1e..d2b6a5445d 100644 --- a/test/manifolds/probability_simplex.jl +++ b/test/manifolds/probability_simplex.jl @@ -18,7 +18,7 @@ include("../utils.jl") @test !is_flat(M) @test is_vector(M, p, X) @test is_vector(M, p, Y) - @test_throws ManifoldDomainError is_vector(M, p .+ 1, X; error=:error) + @test_throws DomainError is_vector(M, p .+ 1, X; error=:error) @test_throws ManifoldDomainError is_vector(M, p, zeros(4); error=:error) @test_throws DomainError is_vector(M, p, Y .+ 1; error=:error) From d39ca6e45cb1f3985a73cd0347bf784d4a9c5153 Mon Sep 17 00:00:00 2001 From: Ronny Bergmann Date: Tue, 17 Oct 2023 15:19:58 +0200 Subject: [PATCH 2/8] Adapt a few more error tests. --- test/manifolds/essential_manifold.jl | 4 ++-- test/manifolds/grassmann.jl | 4 ++-- test/manifolds/hyperbolic.jl | 2 +- test/manifolds/multinomial_matrices.jl | 4 ++-- test/manifolds/oblique.jl | 4 ++-- test/manifolds/product_manifold.jl | 9 ++++++++- test/manifolds/skewhermitian.jl | 6 +++--- test/manifolds/sphere_symmetric_matrices.jl | 2 +- test/manifolds/stiefel.jl | 4 ++-- test/manifolds/symmetric.jl | 6 +++--- 10 files changed, 26 insertions(+), 19 deletions(-) diff --git a/test/manifolds/essential_manifold.jl b/test/manifolds/essential_manifold.jl index 26c3e34db4..a05e3edd98 100644 --- a/test/manifolds/essential_manifold.jl +++ b/test/manifolds/essential_manifold.jl @@ -31,8 +31,8 @@ include("../utils.jl") @test_throws DomainError is_vector( M, p1, - [0.0 0.0 0.0; 0.0 0.0 0.0; 0.0 0.0 0.0], - true, + [0.0 0.0 0.0; 0.0 0.0 0.0; 0.0 0.0 0.0]; + error=:error, ) @test !is_vector(M, np1, [0.0 0.0 0.0; 0.0 0.0 0.0; 0.0 0.0 0.0]) @test !is_vector(M, p1, p2) diff --git a/test/manifolds/grassmann.jl b/test/manifolds/grassmann.jl index 4750b35a32..500ad62f5a 100644 --- a/test/manifolds/grassmann.jl +++ b/test/manifolds/grassmann.jl @@ -177,8 +177,8 @@ include("../utils.jl") @test_throws ManifoldDomainError is_vector( M, [1.0 0.0; 0.0 1.0; 0.0 0.0], - ones(3, 2), - true, + ones(3, 2); + error=:error, ) @test is_vector( M, diff --git a/test/manifolds/hyperbolic.jl b/test/manifolds/hyperbolic.jl index 26633060bd..887627371c 100644 --- a/test/manifolds/hyperbolic.jl +++ b/test/manifolds/hyperbolic.jl @@ -19,7 +19,7 @@ include("../utils.jl") @test_throws DomainError is_point(M, [2.0, 0.0, 0.0]; error=:error) @test !is_point(M, [2.0, 0.0, 0.0]) @test !is_vector(M, [1.0, 0.0, 0.0], [1.0, 0.0, 0.0]) - @test_throws ManifoldDomainError is_vector( + @test_throws DomainError is_vector( M, [1.0, 0.0, 0.0], [1.0, 0.0, 0.0]; diff --git a/test/manifolds/multinomial_matrices.jl b/test/manifolds/multinomial_matrices.jl index 68f96f586b..c04d07410f 100644 --- a/test/manifolds/multinomial_matrices.jl +++ b/test/manifolds/multinomial_matrices.jl @@ -25,8 +25,8 @@ include("../utils.jl") @test_throws CompositeManifoldError{ComponentManifoldError{Int64,DomainError}} is_vector( M, p2, - [-1.0, 0.0, 0.0], - true, + [-1.0, 0.0, 0.0]; + error=:error, ) @test !is_vector(M, p2, [-1.0, 0.0, 0.0]) @test_throws DomainError is_vector(M, p, [-1.0, 0.0, 0.0]; error=:error) diff --git a/test/manifolds/oblique.jl b/test/manifolds/oblique.jl index 2463653660..4f51907aea 100644 --- a/test/manifolds/oblique.jl +++ b/test/manifolds/oblique.jl @@ -22,8 +22,8 @@ include("../utils.jl") @test_throws CompositeManifoldError{ComponentManifoldError{Int64,DomainError}} is_vector( M, p2, - [0.0, 0.0, 0.0], - true, + [0.0, 0.0, 0.0]; + error=:error, ) @test !is_vector(M, p2, [0.0, 0.0, 0.0]) @test_throws DomainError is_vector(M, p, [0.0, 0.0, 0.0]; error=:error) # p wrong diff --git a/test/manifolds/product_manifold.jl b/test/manifolds/product_manifold.jl index d9d74cd1e6..0f4bbbcc3d 100644 --- a/test/manifolds/product_manifold.jl +++ b/test/manifolds/product_manifold.jl @@ -37,7 +37,14 @@ using RecursiveArrayTools: ArrayPartition # test that arrays are not points @test_throws DomainError is_point(Mse, [1, 2]; error=:error) @test check_point(Mse, [1, 2]) isa DomainError - @test_throws DomainError is_vector(Mse, 1, [1, 2], true; check_base_point=false) + @test_throws DomainError is_vector( + Mse, + 1, + [1, 2]; + error=:error, + true; + check_base_point=false, + ) @test check_vector(Mse, 1, [1, 2]; check_base_point=false) isa DomainError #default fallbacks for check_size, Product not working with Arrays @test Manifolds.check_size(Mse, zeros(2)) isa DomainError diff --git a/test/manifolds/skewhermitian.jl b/test/manifolds/skewhermitian.jl index 79686d1a0d..7fd5a7600e 100644 --- a/test/manifolds/skewhermitian.jl +++ b/test/manifolds/skewhermitian.jl @@ -29,13 +29,13 @@ end @test_throws DomainError is_point(M, D; error=:error) @test check_vector(M, B_skewsym, B_skewsym) === nothing @test_throws DomainError is_vector(M, B_skewsym, A; error=:error) - @test_throws ManifoldDomainError is_vector(M, A, B_skewsym; error=:error) + @test_throws DomainError is_vector(M, A, B_skewsym; error=:error) @test_throws DomainError is_vector(M, B_skewsym, D; error=:error) @test_throws ManifoldDomainError is_vector( M, B_skewsym, - 1 * im * zero_vector(M, B_skewsym), - true, + 1 * im * zero_vector(M, B_skewsym); + error=:error, ) @test manifold_dimension(M) == 3 @test manifold_dimension(M_complex) == 9 diff --git a/test/manifolds/sphere_symmetric_matrices.jl b/test/manifolds/sphere_symmetric_matrices.jl index d6756bfb19..255a35e0bc 100644 --- a/test/manifolds/sphere_symmetric_matrices.jl +++ b/test/manifolds/sphere_symmetric_matrices.jl @@ -25,7 +25,7 @@ include("../utils.jl") @test_throws ManifoldDomainError is_vector(M, A, B; error=:error) @test_throws ManifoldDomainError is_vector(M, A, C; error=:error) @test_throws ManifoldDomainError is_vector(M, A, D; error=:error) - @test_throws ManifoldDomainError is_vector(M, D, A; error=:error) + @test_throws DomainError is_vector(M, D, A; error=:error) @test_throws ManifoldDomainError is_vector(M, A, E; error=:error) @test_throws DomainError is_vector(M, J, K; error=:error) @test manifold_dimension(M) == 5 diff --git a/test/manifolds/stiefel.jl b/test/manifolds/stiefel.jl index d1a65bcea5..6154ce2a28 100644 --- a/test/manifolds/stiefel.jl +++ b/test/manifolds/stiefel.jl @@ -128,7 +128,7 @@ include("../utils.jl") @test !is_point(M, 2 * x) @test_throws DomainError !is_point(M, 2 * x; error=:error) @test !is_vector(M, 2 * x, v) - @test_throws ManifoldDomainError !is_vector(M, 2 * x, v; error=:error) + @test_throws DomainError !is_vector(M, 2 * x, v; error=:error) @test !is_vector(M, x, y) @test_throws DomainError is_vector(M, x, y; error=:error) test_manifold( @@ -227,7 +227,7 @@ include("../utils.jl") @test !is_point(M, 2 * x) @test_throws DomainError !is_point(M, 2 * x; error=:error) @test !is_vector(M, 2 * x, v) - @test_throws ManifoldDomainError !is_vector(M, 2 * x, v; error=:error) + @test_throws DomainError !is_vector(M, 2 * x, v; error=:error) @test !is_vector(M, x, y) @test_throws DomainError is_vector(M, x, y; error=:error) test_manifold( diff --git a/test/manifolds/symmetric.jl b/test/manifolds/symmetric.jl index efb47a2d13..5e0ce75a1e 100644 --- a/test/manifolds/symmetric.jl +++ b/test/manifolds/symmetric.jl @@ -24,13 +24,13 @@ include("../utils.jl") @test_throws ManifoldDomainError is_point(M, D; error=:error) #embedding changes type @test check_vector(M, B_sym, B_sym) === nothing @test_throws DomainError is_vector(M, B_sym, A; error=:error) - @test_throws ManifoldDomainError is_vector(M, A, B_sym; error=:error) + @test_throws DomainError is_vector(M, A, B_sym; error=:error) @test_throws ManifoldDomainError is_vector(M, B_sym, D; error=:error) @test_throws ManifoldDomainError is_vector( M, B_sym, - 1 * im * zero_vector(M, B_sym), - true, + 1 * im * zero_vector(M, B_sym); + error=:error, ) @test manifold_dimension(M) == 6 @test manifold_dimension(M_complex) == 9 From b6402641dde9bf4280b818ac2f10b81febb7c030 Mon Sep 17 00:00:00 2001 From: Ronny Bergmann Date: Tue, 17 Oct 2023 15:27:20 +0200 Subject: [PATCH 3/8] Fix a. few more errors. --- test/groups/general_linear.jl | 4 ++-- test/groups/general_unitary_groups.jl | 6 +++--- test/manifolds/symmetric.jl | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/groups/general_linear.jl b/test/groups/general_linear.jl index 59eaa631ad..b3e76768fb 100644 --- a/test/groups/general_linear.jl +++ b/test/groups/general_linear.jl @@ -71,7 +71,7 @@ using NLsolve @test_throws DomainError is_point(G, Float64[0 0 0; 0 1 1; 1 1 1]; error=:error) @test is_point(G, Float64[0 0 1; 0 1 1; 1 1 1]; error=:error) @test is_point(G, Identity(G); error=:error) - @test_throws ManifoldDomainError is_vector( + @test_throws DomainError is_vector( G, Float64[0 1 1; 0 1 1; 1 0 0], randn(3, 3); @@ -151,7 +151,7 @@ using NLsolve Float64[0 0 0; 0 1 1; 1 1 1]; error=:error, ) - @test_throws ManifoldDomainError is_vector( + @test_throws DomainError is_vector( G, ComplexF64[im im; im im], randn(ComplexF64, 2, 2); diff --git a/test/groups/general_unitary_groups.jl b/test/groups/general_unitary_groups.jl index 1a7c69bdb7..1c23d4a7db 100644 --- a/test/groups/general_unitary_groups.jl +++ b/test/groups/general_unitary_groups.jl @@ -160,14 +160,14 @@ include("group_utils.jl") Xe = ones(2, 2) X = project(SU2, q, Xe) @test is_vector(SU2, q, X) - @test_throws ManifoldDomainError is_vector(SU2, p, X, true; error=:error) # base point wrong + @test_throws DomainError is_vector(SU2, p, X, true; error=:error) # base point wrong @test_throws DomainError is_vector(SU2, q, Xe, true; error=:error) # Xe not skew hermitian @test_throws DomainError is_vector( SU2, Identity(AdditionOperation()), Xe, - true, - true, + true; + error = :error, ) # base point wrong e = Identity(MultiplicationOperation()) @test_throws DomainError is_vector(SU2, e, Xe, true; error=:error) # Xe not skew hermitian diff --git a/test/manifolds/symmetric.jl b/test/manifolds/symmetric.jl index 5e0ce75a1e..3132b77a07 100644 --- a/test/manifolds/symmetric.jl +++ b/test/manifolds/symmetric.jl @@ -26,7 +26,7 @@ include("../utils.jl") @test_throws DomainError is_vector(M, B_sym, A; error=:error) @test_throws DomainError is_vector(M, A, B_sym; error=:error) @test_throws ManifoldDomainError is_vector(M, B_sym, D; error=:error) - @test_throws ManifoldDomainError is_vector( + @test_throws DomainError is_vector( M, B_sym, 1 * im * zero_vector(M, B_sym); From eb3f9202dbca27474b4cf4833a746a1e78182309 Mon Sep 17 00:00:00 2001 From: Ronny Bergmann Date: Tue, 17 Oct 2023 15:30:15 +0200 Subject: [PATCH 4/8] Update test/groups/general_unitary_groups.jl Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- test/groups/general_unitary_groups.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/groups/general_unitary_groups.jl b/test/groups/general_unitary_groups.jl index 1c23d4a7db..a3829e2990 100644 --- a/test/groups/general_unitary_groups.jl +++ b/test/groups/general_unitary_groups.jl @@ -167,7 +167,7 @@ include("group_utils.jl") Identity(AdditionOperation()), Xe, true; - error = :error, + error=:error, ) # base point wrong e = Identity(MultiplicationOperation()) @test_throws DomainError is_vector(SU2, e, Xe, true; error=:error) # Xe not skew hermitian From 26296466afc74c7aff29a1accf7ec0eefa94ce5a Mon Sep 17 00:00:00 2001 From: Mateusz Baran Date: Tue, 17 Oct 2023 18:32:18 +0200 Subject: [PATCH 5/8] some fixes --- src/groups/group.jl | 32 +++++++++++++++++++++--------- src/manifolds/MetricManifold.jl | 10 ++++------ test/groups/special_linear.jl | 4 ++-- test/groups/special_orthogonal.jl | 2 ++ test/manifolds/product_manifold.jl | 9 +-------- test/manifolds/symmetric.jl | 2 +- test/manifolds/symplectic.jl | 4 ++-- 7 files changed, 35 insertions(+), 28 deletions(-) diff --git a/src/groups/group.jl b/src/groups/group.jl index ed54b34796..198279ad2b 100644 --- a/src/groups/group.jl +++ b/src/groups/group.jl @@ -384,12 +384,18 @@ end function is_point( ::TraitList{<:IsGroupManifold}, G::AbstractDecoratorManifold, - e::Identity, - te::Bool=false; + e::Identity; + error::Symbol=:none, kwargs..., ) ie = is_identity(G, e; kwargs...) - (te && !ie) && throw(DomainError(e, "The provided identity is not a point on $G.")) + if !ie + s = "The provided identity is not a point on $G." + (error === :error) && throw(DomainError(e, s)) + (error === :info) && @info s + (error === :warn) && @warn s + end + return ie end @@ -398,16 +404,24 @@ function is_vector( G::AbstractDecoratorManifold, e::Identity, X, - te::Bool=false, - cbp=true; + cbp::Bool=true; + error::Symbol=:none, kwargs..., ) if cbp - # pass te down so this throws an error if te=true - # if !te and is_point was false -> return false, otherwise continue - (!te && !is_point(G, e, te; kwargs...)) && return false + # pass te down so this throws an error if error=:error + # if error is not `:error` and is_point was false -> return false, otherwise continue + (!is_point(G, e; error=error, kwargs...)) && return false end - return is_vector(next_trait(t), G, identity_element(G), X, te, false; kwargs...) + return is_vector( + next_trait(t), + G, + identity_element(G), + X, + false; + error=error, + kwargs..., + ) end @doc raw""" diff --git a/src/manifolds/MetricManifold.jl b/src/manifolds/MetricManifold.jl index e83539a050..87ba053734 100644 --- a/src/manifolds/MetricManifold.jl +++ b/src/manifolds/MetricManifold.jl @@ -426,11 +426,10 @@ is_default_metric(::AbstractManifold, ::AbstractMetric) = false function is_point( ::TraitList{IsMetricManifold}, M::MetricManifold{𝔽,TM,G}, - p, - te::Bool=false; + p; kwargs..., ) where {𝔽,G<:AbstractMetric,TM<:AbstractManifold} - return is_point(M.manifold, p, te; kwargs...) + return is_point(M.manifold, p; kwargs...) end function is_vector( @@ -438,11 +437,10 @@ function is_vector( M::MetricManifold{𝔽,TM,G}, p, X, - te::Bool=false, - cbp=true; + cbp::Bool=true; kwargs..., ) where {𝔽,G<:AbstractMetric,TM<:AbstractManifold} - return is_vector(M.manifold, p, X, te, cbp; kwargs...) + return is_vector(M.manifold, p, X, cbp; kwargs...) end @doc raw""" diff --git a/test/groups/special_linear.jl b/test/groups/special_linear.jl index 887dfa0569..107ee1f9cf 100644 --- a/test/groups/special_linear.jl +++ b/test/groups/special_linear.jl @@ -37,7 +37,7 @@ using NLsolve @test_throws DomainError is_point(G, Float64[1 3 3; 1 1 2; 1 2 3]; error=:error) @test is_point(G, Float64[1 1 1; 2 2 1; 2 3 3]; error=:error) @test is_point(G, Identity(G); error=:error) - @test_throws ManifoldDomainError is_vector( + @test_throws DomainError is_vector( G, Float64[2 3 2; 3 1 2; 1 1 1], randn(3, 3); @@ -136,7 +136,7 @@ using NLsolve @test_throws DomainError is_point(G, ComplexF64[1 im; im 1]; error=:error) @test is_point(G, ComplexF64[im 1; -2 im]; error=:error) @test is_point(G, Identity(G); error=:error) - @test_throws ManifoldDomainError is_vector( + @test_throws DomainError is_vector( G, ComplexF64[-1+im -1; -im 1], ComplexF64[1-im 1+im; 1 -1+im]; diff --git a/test/groups/special_orthogonal.jl b/test/groups/special_orthogonal.jl index 9f3f0faa06..1359cbf9bd 100644 --- a/test/groups/special_orthogonal.jl +++ b/test/groups/special_orthogonal.jl @@ -1,6 +1,8 @@ include("../utils.jl") include("group_utils.jl") +using Manifolds: LeftForwardAction, RightBackwardAction + @testset "Special Orthogonal group" begin for n in [2, 3] G = SpecialOrthogonal(n) diff --git a/test/manifolds/product_manifold.jl b/test/manifolds/product_manifold.jl index 0f4bbbcc3d..c1bf2d6486 100644 --- a/test/manifolds/product_manifold.jl +++ b/test/manifolds/product_manifold.jl @@ -37,14 +37,7 @@ using RecursiveArrayTools: ArrayPartition # test that arrays are not points @test_throws DomainError is_point(Mse, [1, 2]; error=:error) @test check_point(Mse, [1, 2]) isa DomainError - @test_throws DomainError is_vector( - Mse, - 1, - [1, 2]; - error=:error, - true; - check_base_point=false, - ) + @test_throws DomainError is_vector(Mse, 1, [1, 2]; error=:error, check_base_point=false) @test check_vector(Mse, 1, [1, 2]; check_base_point=false) isa DomainError #default fallbacks for check_size, Product not working with Arrays @test Manifolds.check_size(Mse, zeros(2)) isa DomainError diff --git a/test/manifolds/symmetric.jl b/test/manifolds/symmetric.jl index 3132b77a07..5e0ce75a1e 100644 --- a/test/manifolds/symmetric.jl +++ b/test/manifolds/symmetric.jl @@ -26,7 +26,7 @@ include("../utils.jl") @test_throws DomainError is_vector(M, B_sym, A; error=:error) @test_throws DomainError is_vector(M, A, B_sym; error=:error) @test_throws ManifoldDomainError is_vector(M, B_sym, D; error=:error) - @test_throws DomainError is_vector( + @test_throws ManifoldDomainError is_vector( M, B_sym, 1 * im * zero_vector(M, B_sym); diff --git a/test/manifolds/symplectic.jl b/test/manifolds/symplectic.jl index 3ef22cd8be..e618d11968 100644 --- a/test/manifolds/symplectic.jl +++ b/test/manifolds/symplectic.jl @@ -190,9 +190,9 @@ using ManifoldDiff @testset "Generate random points/tangent vectors" begin M_big = Symplectic(20) p_big = rand(M_big) - @test is_point(M_big, p_big, true; atol=1.0e-12) + @test is_point(M_big, p_big; error=:error, atol=1.0e-12) X_big = rand(M_big; vector_at=p_big) - @test is_vector(M_big, p_big, X_big, true; atol=1.0e-12) + @test is_vector(M_big, p_big, X_big; error=:error, atol=1.0e-12) end @testset "test_manifold(Symplectic(6), ...)" begin @testset "Type $(Matrix{Float64})" begin From 09cdd06fdbb23dab9f3b1d661487a1060760f052 Mon Sep 17 00:00:00 2001 From: Ronny Bergmann Date: Tue, 17 Oct 2023 18:33:22 +0200 Subject: [PATCH 6/8] More fixes. --- src/groups/group.jl | 11 ++++------- test/manifolds/symmetric.jl | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/groups/group.jl b/src/groups/group.jl index ed54b34796..825eae4267 100644 --- a/src/groups/group.jl +++ b/src/groups/group.jl @@ -398,16 +398,13 @@ function is_vector( G::AbstractDecoratorManifold, e::Identity, X, - te::Bool=false, cbp=true; kwargs..., ) - if cbp - # pass te down so this throws an error if te=true - # if !te and is_point was false -> return false, otherwise continue - (!te && !is_point(G, e, te; kwargs...)) && return false - end - return is_vector(next_trait(t), G, identity_element(G), X, te, false; kwargs...) + # Check POint on group + cbp && (!is_point(G, e; kwargs...)) && (return false) + # set check to false on next trait to not check again + return is_vector(next_trait(t), G, identity_element(G), X, false; kwargs...) end @doc raw""" diff --git a/test/manifolds/symmetric.jl b/test/manifolds/symmetric.jl index 3132b77a07..5e0ce75a1e 100644 --- a/test/manifolds/symmetric.jl +++ b/test/manifolds/symmetric.jl @@ -26,7 +26,7 @@ include("../utils.jl") @test_throws DomainError is_vector(M, B_sym, A; error=:error) @test_throws DomainError is_vector(M, A, B_sym; error=:error) @test_throws ManifoldDomainError is_vector(M, B_sym, D; error=:error) - @test_throws DomainError is_vector( + @test_throws ManifoldDomainError is_vector( M, B_sym, 1 * im * zero_vector(M, B_sym); From 7317d206f637cbb6b96262d9b60a6155e2a2b6ee Mon Sep 17 00:00:00 2001 From: Ronny Bergmann Date: Tue, 17 Oct 2023 19:14:07 +0200 Subject: [PATCH 7/8] Fix the remaining failing tests for group --- src/groups/GroupManifold.jl | 26 ++++++++++++++++++-------- src/groups/group.jl | 7 +++---- test/groups/circle_group.jl | 2 +- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/groups/GroupManifold.jl b/src/groups/GroupManifold.jl index 86fa9fb2d3..c8983731be 100644 --- a/src/groups/GroupManifold.jl +++ b/src/groups/GroupManifold.jl @@ -69,12 +69,17 @@ end function is_point( ::TraitList{<:IsGroupManifold}, G::GroupManifold, - e::Identity, - te::Bool=false; + e::Identity; + error::Symbol=:none, kwargs..., ) ie = is_identity(G, e; kwargs...) - (te && !ie) && throw(DomainError(e, "The provided identity is not a point on $G.")) + if !ie + s = "The provided identity is not a point on $G." + (error === :error) && throw(DomainError(e, s)) + (error === :info) && @info s + (error === :warn) && @warn s + end return ie end @@ -83,16 +88,21 @@ function is_vector( G::GroupManifold, e::Identity, X, - te::Bool=false, - cbp=true; + cbp::Bool; + error::Symbol=:none, kwargs..., ) if cbp ie = is_identity(G, e; kwargs...) - (te && !ie) && throw(DomainError(e, "The provided identity is not a point on $G.")) - (!te && !ie) && return false + if !ie + s = "The provided identity is not a point on $G." + (error === :error) && throw(DomainError(e, s)) + (error === :info) && @info s + (error === :warn) && @warn s + return false + end end - return is_vector(G.manifold, identity_element(G), X, te, false; kwargs...) + return is_vector(G.manifold, identity_element(G), X, false, te; kwargs...) end Base.show(io::IO, G::GroupManifold) = print(io, "GroupManifold($(G.manifold), $(G.op))") diff --git a/src/groups/group.jl b/src/groups/group.jl index 198279ad2b..b56ee94cd0 100644 --- a/src/groups/group.jl +++ b/src/groups/group.jl @@ -391,11 +391,10 @@ function is_point( ie = is_identity(G, e; kwargs...) if !ie s = "The provided identity is not a point on $G." - (error === :error) && throw(DomainError(e, s)) - (error === :info) && @info s - (error === :warn) && @warn s + (error == :error) && throw(DomainError(e, s)) + (error == :info) && @info s + (error == :warn) && @warn s end - return ie end diff --git a/test/groups/circle_group.jl b/test/groups/circle_group.jl index f14ceeac1c..c14f1c5d8b 100644 --- a/test/groups/circle_group.jl +++ b/test/groups/circle_group.jl @@ -28,7 +28,7 @@ using Manifolds: @test !is_point(G, Identity(AdditionOperation())) ef = Identity(AdditionOperation()) @test_throws DomainError is_point(G, ef; error=:error) - @test_throws DomainError is_vector(G, ef, X, true; check_base_point=true) + @test_throws DomainError is_vector(G, ef, X, true; error=:error) end @testset "scalar points" begin From 37324993f2b5af0814929c1203a898a36a3b7ee5 Mon Sep 17 00:00:00 2001 From: Mateusz Baran Date: Tue, 17 Oct 2023 19:43:24 +0200 Subject: [PATCH 8/8] === --- src/groups/group.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/groups/group.jl b/src/groups/group.jl index b56ee94cd0..977a26a4de 100644 --- a/src/groups/group.jl +++ b/src/groups/group.jl @@ -391,9 +391,9 @@ function is_point( ie = is_identity(G, e; kwargs...) if !ie s = "The provided identity is not a point on $G." - (error == :error) && throw(DomainError(e, s)) - (error == :info) && @info s - (error == :warn) && @warn s + (error === :error) && throw(DomainError(e, s)) + (error === :info) && @info s + (error === :warn) && @warn s end return ie end