Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Mateusz Baran <[email protected]>
  • Loading branch information
kellertuer and mateuszbaran authored Dec 15, 2023
1 parent 8b57a5b commit c35aa83
Show file tree
Hide file tree
Showing 20 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/groups/addition_operation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function is_identity(
::AdditionGroupTrait,
G::AbstractDecoratorManifold,
q::T;
atol=sqrt(prod(representation_size(G))) * eps(real(float(number_eltype(T)))),
atol::Real=sqrt(prod(representation_size(G))) * eps(real(float(number_eltype(T)))),
kwargs...,
) where {T}
return isapprox(G, q, zero(q); atol=atol, kwargs...)
Expand Down
2 changes: 1 addition & 1 deletion src/groups/special_linear.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function check_vector(
G::SpecialLinear,
p,
X::T;
atol=sqrt(prod(representation_size(G))) * eps(real(float(number_eltype(T)))),
atol::Real=sqrt(prod(representation_size(G))) * eps(real(float(number_eltype(T)))),
kwargs...,
) where {T}
trX = tr(inverse_translate_diff(G, p, p, X, LeftForwardAction()))
Expand Down
4 changes: 2 additions & 2 deletions src/manifolds/CenteredMatrices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The tolerance for the column sums of `p` can be set using `kwargs...`.
function check_point(
M::CenteredMatrices,
p::T;
atol=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
atol::Real=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
kwargs...,
) where {T}
m, n = get_parameter(M.size)
Expand All @@ -65,7 +65,7 @@ function check_vector(
M::CenteredMatrices,
p,
X::T;
atol=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
atol::Real=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
kwargs...,
) where {T}
m, n = get_parameter(M.size)
Expand Down
4 changes: 2 additions & 2 deletions src/manifolds/CholeskySpace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The tolerance for the tests can be set using the `kwargs...`.
function check_point(
M::CholeskySpace,
p::T;
atol=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
atol::Real=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
kwargs...,
) where {T}
cks = check_size(M, p)
Expand Down Expand Up @@ -63,7 +63,7 @@ function check_vector(
M::CholeskySpace,
p,
X;
atol=sqrt(prod(representation_size(M)) * eps(eltype(p))),
atol::Real=sqrt(prod(representation_size(M)) * eps(float(eltype(p)))),
kwargs...,
)
if !isapprox(norm(strictlyUpperTriangular(X)), 0.0; atol=atol, kwargs...)
Expand Down
2 changes: 1 addition & 1 deletion src/manifolds/Circle.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function check_vector(
M::Circle{ℂ},
p,
X::T;
atol=sqrt(eps(real(float(number_eltype(T))))),
atol::Real=sqrt(eps(real(float(number_eltype(T))))),
kwargs...,
) where {T}
if !isapprox(abs(complex_dot(p, X)), 0; atol=atol, kwargs...)
Expand Down
2 changes: 1 addition & 1 deletion src/manifolds/Elliptope.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function check_vector(
M::Elliptope,
q,
Y::T;
atol=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
atol::Real=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
kwargs...,
) where {T}
X = q * Y' + Y * q'
Expand Down
2 changes: 1 addition & 1 deletion src/manifolds/EmbeddedTorus.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Check whether `X` is a valid vector tangent to `p` on the [`EmbeddedTorus`](@ref
The method checks if the vector `X` is orthogonal to the vector normal to the torus,
see [`normal_vector`](@ref). Absolute tolerance can be set using `atol`.
"""
function check_vector(M::EmbeddedTorus, p, X; atol=eps(float(eltype(p))), kwargs...)
function check_vector(M::EmbeddedTorus, p, X; atol::Real=eps(float(eltype(p))), kwargs...)
dot_nX = dot(normal_vector(M, p), X)
if !isapprox(dot_nX, 0; atol=atol, kwargs...)
return DomainError(dot_nX, "The vector $(X) is not tangent to $(p) from $(M).")
Expand Down
2 changes: 1 addition & 1 deletion src/manifolds/FixedRankMatrices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ function check_vector(
M::FixedRankMatrices,
p::SVDMPoint,
X::UMVTVector;
atol=sqrt(prod(representation_size(M)) * eps(float(eltype(p.U)))),
atol::Real=sqrt(prod(representation_size(M)) * eps(float(eltype(p.U)))),
kwargs...,
)
m, n, k = get_parameter(M.size)
Expand Down
2 changes: 1 addition & 1 deletion src/manifolds/HyperbolicHyperboloid.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function check_vector(
M::Hyperbolic,
p,
X::T;
atol=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
atol::Real=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
kwargs...,
) where {T}
if !isapprox(minkowski_metric(p, X), 0; atol=atol, kwargs...)
Expand Down
4 changes: 2 additions & 2 deletions src/manifolds/KendallsPreShapeSpace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ each row has zero mean. Other conditions are checked via embedding in [`ArraySph
function check_point(
M::KendallsPreShapeSpace,
p;
atol=sqrt(eps(float(eltype(p)))),
atol::Real=sqrt(eps(float(eltype(p)))),
kwargs...,
)
for p_row in eachrow(p)
Expand All @@ -64,7 +64,7 @@ function check_vector(
M::KendallsPreShapeSpace,
p,
X;
atol=sqrt(eps(float(eltype(X)))),
atol::Real=sqrt(eps(float(eltype(X)))),
kwargs...,
)
for X_row in eachrow(X)
Expand Down
4 changes: 2 additions & 2 deletions src/manifolds/MultinomialDoublyStochastic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ i.e. is a matrix with positive entries whose rows and columns sum to one.
function check_point(
M::MultinomialDoubleStochastic,
p::T;
atol=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
atol::Real=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
kwargs...,
) where {T}
n = get_parameter(M.size)[1]
Expand All @@ -87,7 +87,7 @@ function check_vector(
M::MultinomialDoubleStochastic,
p,
X::T;
atol=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
atol::Real=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
kwargs...,
) where {T}
r = sum(X, dims=2) # check for stochastic rows
Expand Down
2 changes: 1 addition & 1 deletion src/manifolds/ProbabilitySimplex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function check_vector(
M::ProbabilitySimplex,
p,
X::T;
atol=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
atol::Real=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
kwargs...,
) where {T}
if !isapprox(sum(X), 0.0; atol=atol, kwargs...)
Expand Down
2 changes: 1 addition & 1 deletion src/manifolds/ProjectiveSpace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function check_vector(
M::AbstractProjectiveSpace,
p,
X::T;
atol=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
atol::Real=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
kwargs...,
) where {T}
if !isapprox(dot(p, X), 0; atol=atol, kwargs...)
Expand Down
2 changes: 1 addition & 1 deletion src/manifolds/SPDFixedDeterminant.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function check_vector(
M::SPDFixedDeterminant,
p,
X::T;
atol=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
atol::Real=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
kwargs...,
) where {T}
if !isapprox(tr(X), 0; atol=atol, kwargs...)
Expand Down
2 changes: 1 addition & 1 deletion src/manifolds/Spectrahedron.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function check_vector(
M::Spectrahedron,
q,
Y::T;
atol=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
atol::Real=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
kwargs...,
) where {T}
X = q * Y' + Y * q'
Expand Down
2 changes: 1 addition & 1 deletion src/manifolds/Sphere.jl
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function check_vector(
M::AbstractSphere,
p,
X::T;
atol=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
atol::Real=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
kwargs...,
) where {T}
if !isapprox(abs(real(dot(p, X))), 0; atol=atol, kwargs...)
Expand Down
4 changes: 2 additions & 2 deletions src/manifolds/SphereSymmetricMatrices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The tolerance for the symmetry of `p` can be set using `kwargs...`.
function check_point(
M::SphereSymmetricMatrices,
p::T;
atol=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
atol::Real=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
kwargs...,
) where {T}
if !isapprox(norm(p - p'), 0; atol=atol, kwargs...)
Expand All @@ -63,7 +63,7 @@ function check_vector(
M::SphereSymmetricMatrices,
p,
X::T;
atol=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
atol::Real=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
kwargs...,
) where {T}
if !isapprox(norm(X - X'), 0; atol=atol, kwargs...)
Expand Down
2 changes: 1 addition & 1 deletion src/manifolds/SymmetricPositiveSemidefiniteFixedRank.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ function _isapprox(
M::SymmetricPositiveSemidefiniteFixedRank,
p::T,
q;
atol=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
atol::Real=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
kwargs...,
) where {T}
return isapprox(norm(p - q), 0; atol=atol, kwargs...) ||
Expand Down
4 changes: 2 additions & 2 deletions src/manifolds/Symplectic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ The tolerance can be set with `kwargs...` (e.g. `atol = 1.0e-14`).
function check_point(
M::Symplectic,
p::T;
atol=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
atol::Real=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
kwargs...,
) where {T}
# Perform check that the matrix lives on the real symplectic manifold:
Expand Down Expand Up @@ -254,7 +254,7 @@ function check_vector(
M::Symplectic,
p,
X::T;
atol=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
atol::Real=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
kwargs...,
) where {T}
Q = SymplecticMatrix(p, X)
Expand Down
4 changes: 2 additions & 2 deletions src/manifolds/SymplecticStiefel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ The tolerance can be set with `kwargs...` (e.g. `atol = 1.0e-14`).
function check_point(
M::SymplecticStiefel,
p::T;
atol=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
atol::Real=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
kwargs...,
) where {T}
# Perform check that the matrix lives on the real symplectic manifold:
Expand Down Expand Up @@ -151,7 +151,7 @@ function check_vector(
M::SymplecticStiefel{S,𝔽},
p,
X::T;
atol=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
atol::Real=sqrt(prod(representation_size(M))) * eps(real(float(number_eltype(T)))),
kwargs...,
) where {S,T,𝔽}
n, k = get_parameter(M.size)
Expand Down

0 comments on commit c35aa83

Please sign in to comment.