From 770bf765f8d83f33f2c7b0b2850edeb72e3317bc Mon Sep 17 00:00:00 2001 From: Ronny Bergmann Date: Fri, 12 Jan 2024 12:07:40 +0100 Subject: [PATCH] Rearrange code to avoid redefining functions. --- src/manifolds/MultinomialSymmetric.jl | 18 +++---- src/manifolds/Oblique.jl | 8 +-- src/manifolds/SphereSymmetricMatrices.jl | 10 ++-- src/manifolds/StiefelEuclideanMetric.jl | 32 ++++++------ src/manifolds/SymmetricPositiveDefinite.jl | 10 ++-- .../SymmetricPositiveSemidefiniteFixedRank.jl | 42 ++++++++-------- test/ambiguities.jl | 11 ++++ test/approx_inverse_retraction.jl | 2 +- test/differentiation.jl | 2 +- test/groups/circle_group.jl | 2 +- test/groups/connections.jl | 2 +- test/groups/general_linear.jl | 2 +- test/groups/general_unitary_groups.jl | 2 +- test/groups/group_operation_action.jl | 2 +- test/groups/groups_general.jl | 2 +- test/groups/heisenberg.jl | 2 +- test/groups/metric.jl | 2 +- test/groups/power_group.jl | 2 +- test/groups/product_group.jl | 2 +- test/groups/rotation_action.jl | 2 +- test/groups/rotation_translation_action.jl | 2 +- test/groups/semidirect_product_group.jl | 2 +- test/groups/special_euclidean.jl | 2 +- test/groups/special_linear.jl | 2 +- test/groups/special_orthogonal.jl | 2 +- test/groups/translation_action.jl | 2 +- test/groups/translation_group.jl | 2 +- test/groups/validation_group.jl | 2 +- test/header.jl | 24 +++++++++ test/manifolds/centered_matrices.jl | 2 +- test/manifolds/cholesky_space.jl | 2 +- test/manifolds/circle.jl | 2 +- test/manifolds/elliptope.jl | 2 +- test/manifolds/essential_manifold.jl | 2 +- test/manifolds/euclidean.jl | 2 +- test/manifolds/fiber.jl | 2 +- test/manifolds/fiber_bundle.jl | 2 +- test/manifolds/fixed_rank.jl | 2 +- test/manifolds/generalized_grassmann.jl | 2 +- test/manifolds/generalized_stiefel.jl | 2 +- test/manifolds/graph.jl | 2 +- test/manifolds/grassmann.jl | 2 +- test/manifolds/hyperbolic.jl | 2 +- test/manifolds/lorentz.jl | 2 +- .../multinomial_doubly_stochastic.jl | 2 +- test/manifolds/multinomial_matrices.jl | 2 +- test/manifolds/multinomial_symmetric.jl | 2 +- test/manifolds/oblique.jl | 2 +- test/manifolds/positive_numbers.jl | 2 +- test/manifolds/power_manifold.jl | 2 +- test/manifolds/probability_simplex.jl | 2 +- test/manifolds/product_manifold.jl | 2 +- test/manifolds/projective_space.jl | 2 +- test/manifolds/quotient_manifold.jl | 2 +- test/manifolds/rotations.jl | 2 +- test/manifolds/shape_space.jl | 2 +- test/manifolds/skewhermitian.jl | 2 +- test/manifolds/spd_fixed_determinant.jl | 2 +- test/manifolds/spectrahedron.jl | 2 +- test/manifolds/sphere.jl | 2 +- test/manifolds/sphere_symmetric_matrices.jl | 2 +- test/manifolds/stiefel.jl | 2 +- test/manifolds/symmetric.jl | 2 +- test/manifolds/symmetric_positive_definite.jl | 2 +- ...metric_positive_semidefinite_fixed_rank.jl | 2 +- test/manifolds/symplectic.jl | 2 +- test/manifolds/symplecticstiefel.jl | 2 +- test/manifolds/torus.jl | 2 +- test/manifolds/tucker.jl | 2 +- test/manifolds/unitary_matrices.jl | 2 +- test/manifolds/vector_bundle.jl | 2 +- test/metric.jl | 2 +- test/notation.jl | 2 +- test/recipes.jl | 2 +- test/runtests.jl | 9 +++- test/statistics.jl | 2 +- test/utils.jl | 50 ------------------- 77 files changed, 169 insertions(+), 179 deletions(-) create mode 100644 test/header.jl delete mode 100644 test/utils.jl diff --git a/src/manifolds/MultinomialSymmetric.jl b/src/manifolds/MultinomialSymmetric.jl index 23b178b368..110d782bf9 100644 --- a/src/manifolds/MultinomialSymmetric.jl +++ b/src/manifolds/MultinomialSymmetric.jl @@ -1,7 +1,7 @@ @doc raw""" MultinomialSymmetric{T} <: AbstractMultinomialDoublyStochastic{N} -The multinomial symmetric matrices manifold consists of all symmetric $n×n$ matrices with +The multinomial symmetric matrices manifold consists of all symmetric ``n×n`` matrices with positive entries such that each column sums to one, i.e. ````math @@ -13,7 +13,7 @@ positive entries such that each column sums to one, i.e. \end{aligned} ```` -where $\mathbf{1}_n$ is the vector of length $n$ containing ones. +where ``\mathbf{1}_n`` is the vector of length ``n`` containing ones. It is modeled as [`IsIsometricEmbeddedManifold`](https://juliamanifolds.github.io/ManifoldsBase.jl/stable/decorator.html#ManifoldsBase.IsIsometricEmbeddedManifold). via the [`AbstractMultinomialDoublyStochastic`](@ref) type, since it shares a few functions @@ -29,7 +29,7 @@ X\mathbf{1}_n = \mathbf{0}_n \bigr\}, ```` -where $\mathbf{0}_n$ is the vector of length $n$ containing zeros. +where ``\mathbf{0}_n`` is the vector of length ``n`` containing zeros. More details can be found in Section IV [DouikHassibi:2019](@cite). @@ -37,7 +37,7 @@ More details can be found in Section IV [DouikHassibi:2019](@cite). MultinomialSymmetric(n) -Generate the manifold of matrices $\mathbb R^{n×n}$ that are doubly stochastic and symmetric. +Generate the manifold of matrices ``\mathbb R^{n×n}`` that are doubly stochastic and symmetric. """ struct MultinomialSymmetric{T} <: AbstractMultinomialDoublyStochastic size::T @@ -110,12 +110,12 @@ The formula reads ````math \operatorname{proj}_p(Y) = Y - (α\mathbf{1}_n^{\mathrm{T}} + \mathbf{1}_n α^{\mathrm{T}}) ⊙ p, ```` -where $⊙$ denotes the Hadamard or elementwise product and $\mathbb{1}_n$ is the vector of length $n$ containing ones. -The two vector $α ∈ ℝ^{n×n}$ is given by solving +where ``⊙`` denotes the Hadamard or elementwise product and ``\mathbb{1}_n`` is the vector of length ``n`` containing ones. +The two vector ``α ∈ ℝ^{n×n}`` is given by solving ````math (I_n+p)α = Y\mathbf{1}, ```` -where $I_n$ is teh $n×n$ unit matrix and $\mathbf{1}_n$ is the vector of length $n$ containing ones. +where ``I_n`` is teh ``n×n`` unit matrix and ``\mathbf{1}_n`` is the vector of length ``n`` containing ones. """ project(::MultinomialSymmetric, ::Any, ::Any) @@ -133,8 +133,8 @@ end @doc raw""" retract(M::MultinomialSymmetric, p, X, ::ProjectionRetraction) -compute a projection based retraction by projecting $p\odot\exp(X⨸p)$ back onto the manifold, -where $⊙,⨸$ are elementwise multiplication and division, respectively. Similarly, $\exp$ +compute a projection based retraction by projecting ``p⊙\exp(X⨸p)`` back onto the manifold, +where ``⊙,⨸`` are elementwise multiplication and division, respectively. Similarly, ``\exp`` refers to the elementwise exponentiation. """ retract(::MultinomialSymmetric, ::Any, ::Any, ::ProjectionRetraction) diff --git a/src/manifolds/Oblique.jl b/src/manifolds/Oblique.jl index 5ca96de428..94407b7564 100644 --- a/src/manifolds/Oblique.jl +++ b/src/manifolds/Oblique.jl @@ -1,10 +1,10 @@ @doc raw""" Oblique{T,𝔽,S} <: AbstractPowerManifold{𝔽} -The oblique manifold $\mathcal{OB}(n,m)$ is the set of 𝔽-valued matrices with unit norm +The oblique manifold ``\mathcal{OB}(n,m)`` is the set of 𝔽-valued matrices with unit norm column endowed with the metric from the embedding. This yields exactly the same metric as considering the product metric of the unit norm vectors, i.e. [`PowerManifold`](https://juliamanifolds.github.io/ManifoldsBase.jl/stable/manifolds.html#ManifoldsBase.PowerManifold) of the -$(n-1)$-dimensional [`Sphere`](@ref). +``(n-1)``-dimensional [`Sphere`](@ref). The [`Sphere`](@ref) is stored internally within `M.manifold`, such that all functions of [`AbstractPowerManifold`](https://juliamanifolds.github.io/ManifoldsBase.jl/stable/manifolds.html#ManifoldsBase.AbstractPowerManifold) can be used directly. @@ -13,7 +13,7 @@ The [`Sphere`](@ref) is stored internally within `M.manifold`, such that all fun Oblique(n::Int, m::Int, field::AbstractNumbers=ℝ; parameter::Symbol=:type) -Generate the manifold of matrices $\mathbb R^{n×m}$ such that the $m$ columns are unit +Generate the manifold of matrices ``\mathbb R^{n×m}`` such that the ``m`` columns are unit vectors, i.e. from the [`Sphere`](@ref)`(n-1)`. """ struct Oblique{T,𝔽,S} <: AbstractPowerManifold{𝔽,Sphere{S,𝔽},ArrayPowerRepresentation} @@ -39,7 +39,7 @@ end check_point(M::Oblique, p) Checks whether `p` is a valid point on the [`Oblique`](@ref)`{m,n}` `M`, i.e. is a matrix -of `m` unit columns from $\mathbb R^{n}$, i.e. each column is a point from +of `m` unit columns from ``\mathbb R^{n}``, i.e. each column is a point from [`Sphere`](@ref)`(n-1)`. """ check_point(::Oblique, ::Any) diff --git a/src/manifolds/SphereSymmetricMatrices.jl b/src/manifolds/SphereSymmetricMatrices.jl index 1b691ef5cb..d023e881c7 100644 --- a/src/manifolds/SphereSymmetricMatrices.jl +++ b/src/manifolds/SphereSymmetricMatrices.jl @@ -1,13 +1,13 @@ @doc raw""" SphereSymmetricMatrices{T,𝔽} <: AbstractEmbeddedManifold{ℝ,TransparentIsometricEmbedding} -The [`AbstractManifold`](https://juliamanifolds.github.io/ManifoldsBase.jl/stable/types.html#ManifoldsBase.AbstractManifold) consisting of the $n×n$ symmetric matrices +The [`AbstractManifold`](https://juliamanifolds.github.io/ManifoldsBase.jl/stable/types.html#ManifoldsBase.AbstractManifold) consisting of the ``n×n`` symmetric matrices of unit Frobenius norm, i.e. ````math \mathcal{S}_{\text{sym}} :=\bigl\{p ∈ 𝔽^{n×n}\ \big|\ p^{\mathrm{H}} = p, \lVert p \rVert = 1 \bigr\}, ```` -where $⋅^{\mathrm{H}}$ denotes the Hermitian, i.e. complex conjugate transpose, -and the field $𝔽 ∈ \{ ℝ, ℂ\}$. +where ``⋅^{\mathrm{H}}`` denotes the Hermitian, i.e. complex conjugate transpose, +and the field ``𝔽 ∈ \{ ℝ, ℂ\}``. # Constructor SphereSymmetricMatrices(n[, field=ℝ]) @@ -119,7 +119,7 @@ Projects `p` from the embedding onto the [`SphereSymmetricMatrices`](@ref) `M`, ````math \operatorname{proj}_{\mathcal{S}_{\text{sym}}}(p) = \frac{1}{2} \bigl( p + p^{\mathrm{H}} \bigr), ```` -where $⋅^{\mathrm{H}}$ denotes the Hermitian, i.e. complex conjugate transposed. +where ``⋅^{\mathrm{H}}`` denotes the Hermitian, i.e. complex conjugate transposed. """ project(::SphereSymmetricMatrices, ::Any) @@ -135,7 +135,7 @@ Project the matrix `X` onto the tangent space at `p` on the [`SphereSymmetricMat ````math \operatorname{proj}_p(X) = \frac{X + X^{\mathrm{H}}}{2} - ⟨p, \frac{X + X^{\mathrm{H}}}{2}⟩p, ```` -where $⋅^{\mathrm{H}}$ denotes the Hermitian, i.e. complex conjugate transposed. +where ``⋅^{\mathrm{H}}`` denotes the Hermitian, i.e. complex conjugate transposed. """ project(::SphereSymmetricMatrices, ::Any, ::Any) diff --git a/src/manifolds/StiefelEuclideanMetric.jl b/src/manifolds/StiefelEuclideanMetric.jl index 16c07ef16c..9edc20aba3 100644 --- a/src/manifolds/StiefelEuclideanMetric.jl +++ b/src/manifolds/StiefelEuclideanMetric.jl @@ -17,9 +17,9 @@ emanating from `p` in tangent direction `X`. \begin{pmatrix} \exp( -p^{\mathrm{H}}X) \\ 0_n\end{pmatrix}, ```` -where $\operatorname{Exp}$ denotes matrix exponential, -$⋅^{\mathrm{H}}$ denotes the complex conjugate transpose or Hermitian, and $I_k$ and -$0_k$ are the identity matrix and the zero matrix of dimension $k×k$, respectively. +where ``\operatorname{Exp}`` denotes matrix exponential, +``⋅^{\mathrm{H}}`` denotes the complex conjugate transpose or Hermitian, and ``I_k`` and +``0_k`` are the identity matrix and the zero matrix of dimension ``k×k``, respectively. """ exp(::Stiefel, ::Any...) @@ -38,25 +38,25 @@ end @doc raw""" get_basis(M::Stiefel{<:Any,ℝ}, p, B::DefaultOrthonormalBasis) -Create the default basis using the parametrization for any $X ∈ T_p\mathcal M$. -Set $p_\bot \in ℝ^{n×(n-k)}$ the matrix such that the $n×n$ matrix of the common -columns $[p\ p_\bot]$ is an ONB. -For any skew symmetric matrix $a ∈ ℝ^{k×k}$ and any $b ∈ ℝ^{(n-k)×k}$ the matrix +Create the default basis using the parametrization for any ``X ∈ T_p\mathcal M``. +Set ``p_\bot \in ℝ^{n×(n-k)}`` the matrix such that the ``n×n`` matrix of the common +columns ``[p\ p_\bot]`` is an ONB. +For any skew symmetric matrix ``a ∈ ℝ^{k×k}`` and any ``b ∈ ℝ^{(n-k)×k}`` the matrix ````math X = pa + p_\bot b ∈ T_p\mathcal M ```` -and we can use the $\frac{1}{2}k(k-1) + (n-k)k = nk-\frac{1}{2}k(k+1)$ entries -of $a$ and $b$ to specify a basis for the tangent space. +and we can use the ``\frac{1}{2}k(k-1) + (n-k)k = nk-\frac{1}{2}k(k+1)`` entries +of ``a`` and ``b`` to specify a basis for the tangent space. using unit vectors for constructing both -the upper matrix of $a$ to build a skew symmetric matrix and the matrix b, the default +the upper matrix of ``a`` to build a skew symmetric matrix and the matrix b, the default basis is constructed. -Since $[p\ p_\bot]$ is an automorphism on $ℝ^{n×p}$ the elements of $a$ and $b$ are +Since ``[p\ p_⊥]`` is an automorphism on ``ℝ^{n×p}`` the elements of ``a`` and ``b`` are orthonormal coordinates for the tangent space. To be precise exactly one element in the upper -trangular entries of $a$ is set to $1$ its symmetric entry to $-1$ and we normalize with -the factor $\frac{1}{\sqrt{2}}$ and for $b$ one can just use unit vectors reshaped to a matrix +trangular entries of ``a`` is set to ``1`` its symmetric entry to ``-1`` and we normalize with +the factor ``\frac{1}{\sqrt{2}}`` and for ``b`` one can just use unit vectors reshaped to a matrix to obtain orthonormal set of parameters. """ get_basis(M::Stiefel{<:Any,ℝ}, p, B::DefaultOrthonormalBasis{ℝ,TangentSpaceType}) @@ -128,7 +128,7 @@ end project(M::Stiefel,p) Projects `p` from the embedding onto the [`Stiefel`](@ref) `M`, i.e. compute `q` -as the polar decomposition of $p$ such that ``q^{\mathrm{H}}q`` is the identity, +as the polar decomposition of ``p`` such that ``q^{\mathrm{H}}q`` is the identity, where ``⋅^{\mathrm{H}}`` denotes the hermitian, i.e. complex conjugate transposed. """ project(::Stiefel, ::Any, ::Any) @@ -149,8 +149,8 @@ The formula reads \operatorname{proj}_{T_p\mathcal M}(X) = X - p \operatorname{Sym}(p^{\mathrm{H}}X), ```` -where $\operatorname{Sym}(q)$ is the symmetrization of $q$, e.g. by -$\operatorname{Sym}(q) = \frac{q^{\mathrm{H}}+q}{2}$. +where ``\operatorname{Sym}(q)`` is the symmetrization of ``q``, e.g. by +``\operatorname{Sym}(q) = \frac{q^{\mathrm{H}}+q}{2}``. """ project(::Stiefel, ::Any...) diff --git a/src/manifolds/SymmetricPositiveDefinite.jl b/src/manifolds/SymmetricPositiveDefinite.jl index 746ea87dfd..95d051b9ec 100644 --- a/src/manifolds/SymmetricPositiveDefinite.jl +++ b/src/manifolds/SymmetricPositiveDefinite.jl @@ -24,7 +24,7 @@ i.e. the set of symmetric matrices, SymmetricPositiveDefinite(n; parameter::Symbol=:type) -generates the manifold $\mathcal P(n) \subset ℝ^{n×n}$ +generates the manifold ``\mathcal P(n) \subset ℝ^{n×n}`` """ struct SymmetricPositiveDefinite{T} <: AbstractDecoratorManifold{ℝ} size::T @@ -243,7 +243,7 @@ end Return the injectivity radius of the [`SymmetricPositiveDefinite`](@ref). Since `M` is a Hadamard manifold with respect to the [`AffineInvariantMetric`](@ref) and the -[`LogCholeskyMetric`](@ref), the injectivity radius is globally $∞$. +[`LogCholeskyMetric`](@ref), the injectivity radius is globally ``∞``. """ injectivity_radius(::SymmetricPositiveDefinite) = Inf injectivity_radius(::SymmetricPositiveDefinite, p) = Inf @@ -265,7 +265,7 @@ is_flat(M::SymmetricPositiveDefinite) = false manifold_dimension(M::SymmetricPositiveDefinite) returns the dimension of -[`SymmetricPositiveDefinite`](@ref) `M`$=\mathcal P(n), n ∈ ℕ$, i.e. +[`SymmetricPositiveDefinite`](@ref) `M` ``=\mathcal P(n), n ∈ ℕ``, i.e. ````math \dim \mathcal P(n) = \frac{n(n+1)}{2}. ```` @@ -466,8 +466,8 @@ end representation_size(M::SymmetricPositiveDefinite) Return the size of an array representing an element on the -[`SymmetricPositiveDefinite`](@ref) manifold `M`, i.e. $n×n$, the size of such a -symmetric positive definite matrix on $\mathcal M = \mathcal P(n)$. +[`SymmetricPositiveDefinite`](@ref) manifold `M`, i.e. ``n×n``, the size of such a +symmetric positive definite matrix on ``\mathcal M = \mathcal P(n)``. """ function representation_size(M::SymmetricPositiveDefinite) N = get_parameter(M.size)[1] diff --git a/src/manifolds/SymmetricPositiveSemidefiniteFixedRank.jl b/src/manifolds/SymmetricPositiveSemidefiniteFixedRank.jl index e72804ecf5..46d3d867d7 100644 --- a/src/manifolds/SymmetricPositiveSemidefiniteFixedRank.jl +++ b/src/manifolds/SymmetricPositiveSemidefiniteFixedRank.jl @@ -1,8 +1,8 @@ @doc raw""" SymmetricPositiveSemidefiniteFixedRank{T,𝔽} <: AbstractDecoratorManifold{𝔽} -The [`AbstractManifold`](https://juliamanifolds.github.io/ManifoldsBase.jl/stable/types.html#ManifoldsBase.AbstractManifold) $ \operatorname{SPS}_k(n)$ consisting of the real- or complex-valued -symmetric positive semidefinite matrices of size $n×n$ and rank $k$, i.e. the set +The [`AbstractManifold`](https://juliamanifolds.github.io/ManifoldsBase.jl/stable/types.html#ManifoldsBase.AbstractManifold) `` \operatorname{SPS}_k(n)`` consisting of the real- or complex-valued +symmetric positive semidefinite matrices of size ``n×n`` and rank ``k``, i.e. the set ````math \operatorname{SPS}_k(n) = \bigl\{ @@ -10,18 +10,18 @@ p ∈ 𝔽^{n×n}\ \big|\ p^{\mathrm{H}} = p, apa^{\mathrm{H}} \geq 0 \text{ for all } a ∈ 𝔽 \text{ and } \operatorname{rank}(p) = k\bigr\}, ```` -where $⋅^{\mathrm{H}}$ denotes the Hermitian, i.e. complex conjugate transpose, -and the field $𝔽 ∈ \{ ℝ, ℂ\}$. -We sometimes $\operatorname{SPS}_{k,𝔽}(n)$, when distinguishing the real- and complex-valued +where ``⋅^{\mathrm{H}}`` denotes the Hermitian, i.e. complex conjugate transpose, +and the field ``𝔽 ∈ \{ ℝ, ℂ\}``. +We sometimes ``\operatorname{SPS}_{k,𝔽}(n)``, when distinguishing the real- and complex-valued manifold is important. -An element is represented by $q ∈ 𝔽^{n×k}$ from the factorization $p = qq^{\mathrm{H}}$. -Note that since for any unitary (orthogonal) $A ∈ 𝔽^{n×n}$ we have -$(Aq)(Aq)^{\mathrm{H}} = qq^{\mathrm{H}} = p$, the representation is not unique, or in -other words, the manifold is a quotient manifold of $𝔽^{n×k}$. +An element is represented by ``q ∈ 𝔽^{n×k}`` from the factorization ``p = qq^{\mathrm{H}}``. +Note that since for any unitary (orthogonal) ``A ∈ 𝔽^{n×n}`` we have +``(Aq)(Aq)^{\mathrm{H}} = qq^{\mathrm{H}} = p``, the representation is not unique, or in +other words, the manifold is a quotient manifold of ``𝔽^{n×k}``. -The tangent space at $p$, $T_p\operatorname{SPS}_k(n)$, is also represented -by matrices $Y ∈ 𝔽^{n×k}$ and reads as +The tangent space at ``p``, ``T_p\operatorname{SPS}_k(n)``, is also represented +by matrices ``Y ∈ 𝔽^{n×k}`` and reads as ````math T_p\operatorname{SPS}_k(n) = \bigl\{ @@ -37,7 +37,7 @@ The metric was used in [JourneeBachAbsilSepulchre:2010](@cite)[MassartAbsil:2020 SymmetricPositiveSemidefiniteFixedRank(n::Int, k::Int, field::AbstractNumbers=ℝ; parameter::Symbol=:type) -Generate the manifold of $n×n$ symmetric positive semidefinite matrices of rank $k$ +Generate the manifold of ``n×n`` symmetric positive semidefinite matrices of rank ``k`` over the `field` of real numbers `ℝ` or complex numbers `ℂ`. """ struct SymmetricPositiveSemidefiniteFixedRank{T,𝔽} <: AbstractDecoratorManifold{𝔽} @@ -107,8 +107,8 @@ end distance(M::SymmetricPositiveSemidefiniteFixedRank, p, q) Compute the distance between two points `p`, `q` on the -[`SymmetricPositiveSemidefiniteFixedRank`](@ref), which is the Frobenius norm of $Y$ which -minimizes $\lVert p - qY\rVert$ with respect to $Y$. +[`SymmetricPositiveSemidefiniteFixedRank`](@ref), which is the Frobenius norm of ``Y`` which +minimizes ``\lVert p - qY\rVert`` with respect to ``Y``. """ distance(M::SymmetricPositiveSemidefiniteFixedRank, p, q) = norm(M, p, log(M, p, q)) @@ -129,8 +129,8 @@ which just reads ````math q_2 = \exp_p(\log_pq) ```` - might yield a matrix $q_2\neq q$, but they represent the same point on the quotient - manifold, i.e. $d_{\operatorname{SPS}_k(n)}(q_2,q) = 0$. + might yield a matrix ``q_2\neq q``, but they represent the same point on the quotient + manifold, i.e. ``d_{\operatorname{SPS}_k(n)}(q_2,q) = 0``. """ exp(::SymmetricPositiveSemidefiniteFixedRank, ::Any, ::Any) @@ -144,7 +144,7 @@ end test, whether two points `p`, `q` are (approximately) nearly the same. Since this is a quotient manifold in the embedding, the test is performed by checking -their distance, if they are not the same, i.e. that $d_{\mathcal M}(p,q) \approx 0$, where +their distance, if they are not the same, i.e. that ``d_{\mathcal M}(p,q) \approx 0``, where the comparison is performed with the classical `isapprox`. The `kwargs...` are passed on to this accordingly. """ @@ -170,7 +170,7 @@ is_flat(M::SymmetricPositiveSemidefiniteFixedRank) = false log(M::SymmetricPositiveSemidefiniteFixedRank, q, p) Compute the logarithmic map on the [`SymmetricPositiveSemidefiniteFixedRank`](@ref) manifold -by minimizing $\lVert p - qY\rVert$ with respect to $Y$. +by minimizing ``\lVert p - qY\rVert`` with respect to ``Y``. !!! note @@ -180,8 +180,8 @@ by minimizing $\lVert p - qY\rVert$ with respect to $Y$. ````math q_2 = \exp_p(\log_pq) ```` - might yield a matrix $q_2\neq q$, but they represent the same point on the quotient - manifold, i.e. $d_{\operatorname{SPS}_k(n)}(q_2,q) = 0$. + might yield a matrix ``q_2≠q``, but they represent the same point on the quotient + manifold, i.e. ``d_{\operatorname{SPS}_k(n)}(q_2,q) = 0``. """ log(::SymmetricPositiveSemidefiniteFixedRank, q, p) @@ -203,7 +203,7 @@ Return the dimension of the [`SymmetricPositiveSemidefiniteFixedRank`](@ref) mat \end{aligned} ```` -where the last $k^2$ is due to the zero imaginary part for Hermitian matrices diagonal +where the last ``k^2`` is due to the zero imaginary part for Hermitian matrices diagonal """ manifold_dimension(::SymmetricPositiveSemidefiniteFixedRank) diff --git a/test/ambiguities.jl b/test/ambiguities.jl index b46f568017..da14e7a079 100644 --- a/test/ambiguities.jl +++ b/test/ambiguities.jl @@ -1,3 +1,14 @@ +""" + has_type_in_signature(sig, T) + Test whether the signature `sig` has an argument of type `T` as one of its paramaters +""" +function has_type_in_signature(sig, T::Type) + return any(map(Base.unwrap_unionall(sig.sig).parameters) do x + xw = Base.rewrap_unionall(x, sig.sig) + return (xw isa Type ? xw : xw.T) <: T + end) +end + @testset "Ambiguities" begin if VERSION.prerelease == () && !Sys.iswindows() && VERSION < v"1.10.0" mbs = Test.detect_ambiguities(ManifoldsBase) diff --git a/test/approx_inverse_retraction.jl b/test/approx_inverse_retraction.jl index 7d9b40ea12..cdf492b2ea 100644 --- a/test/approx_inverse_retraction.jl +++ b/test/approx_inverse_retraction.jl @@ -1,7 +1,7 @@ using NLsolve using LinearAlgebra -include("utils.jl") +include("header.jl") Random.seed!(10) diff --git a/test/differentiation.jl b/test/differentiation.jl index 35a9dca2d7..3db2a3745c 100644 --- a/test/differentiation.jl +++ b/test/differentiation.jl @@ -1,6 +1,6 @@ # A bit of duplication of tests in ManifoldDiff.jl but it ensures that it works here too. -include("utils.jl") +include("header.jl") using Manifolds: default_differential_backend, _derivative, diff --git a/test/groups/circle_group.jl b/test/groups/circle_group.jl index cd6ce39923..5676cd5b4c 100644 --- a/test/groups/circle_group.jl +++ b/test/groups/circle_group.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") include("group_utils.jl") using Manifolds: diff --git a/test/groups/connections.jl b/test/groups/connections.jl index efaaf739af..0d2e4c4a7e 100644 --- a/test/groups/connections.jl +++ b/test/groups/connections.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") include("group_utils.jl") using Manifolds: connection diff --git a/test/groups/general_linear.jl b/test/groups/general_linear.jl index 24fe8026d6..1af110b040 100644 --- a/test/groups/general_linear.jl +++ b/test/groups/general_linear.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") include("group_utils.jl") using NLsolve diff --git a/test/groups/general_unitary_groups.jl b/test/groups/general_unitary_groups.jl index d681c818bb..d2cc2c8c22 100644 --- a/test/groups/general_unitary_groups.jl +++ b/test/groups/general_unitary_groups.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") include("group_utils.jl") @testset "General Unitary Groups" begin diff --git a/test/groups/group_operation_action.jl b/test/groups/group_operation_action.jl index f99542588b..ec7e9d569e 100644 --- a/test/groups/group_operation_action.jl +++ b/test/groups/group_operation_action.jl @@ -1,5 +1,5 @@ -include("../utils.jl") +include("../header.jl") include("group_utils.jl") using Manifolds: diff --git a/test/groups/groups_general.jl b/test/groups/groups_general.jl index 6e3cbb4d8d..710167904b 100644 --- a/test/groups/groups_general.jl +++ b/test/groups/groups_general.jl @@ -1,7 +1,7 @@ using StaticArrays: identity_perm using Base: decode_overlong -include("../utils.jl") +include("../header.jl") include("group_utils.jl") using Manifolds: diff --git a/test/groups/heisenberg.jl b/test/groups/heisenberg.jl index 1e13d24387..86c3ab4188 100644 --- a/test/groups/heisenberg.jl +++ b/test/groups/heisenberg.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") include("group_utils.jl") @testset "Heisenberg group" begin diff --git a/test/groups/metric.jl b/test/groups/metric.jl index f759d20426..fa5b82fb44 100644 --- a/test/groups/metric.jl +++ b/test/groups/metric.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") include("group_utils.jl") using OrdinaryDiffEq diff --git a/test/groups/power_group.jl b/test/groups/power_group.jl index 60000fa36c..d2aa761b94 100644 --- a/test/groups/power_group.jl +++ b/test/groups/power_group.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") include("group_utils.jl") @testset "Power group" begin diff --git a/test/groups/product_group.jl b/test/groups/product_group.jl index 05e251e1a6..b1e1f7e978 100644 --- a/test/groups/product_group.jl +++ b/test/groups/product_group.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") include("group_utils.jl") using RecursiveArrayTools diff --git a/test/groups/rotation_action.jl b/test/groups/rotation_action.jl index 71be2acd73..2a29167258 100644 --- a/test/groups/rotation_action.jl +++ b/test/groups/rotation_action.jl @@ -1,5 +1,5 @@ -include("../utils.jl") +include("../header.jl") include("group_utils.jl") @testset "Rotation action" begin diff --git a/test/groups/rotation_translation_action.jl b/test/groups/rotation_translation_action.jl index 2bb61eb137..8ecf8bbadc 100644 --- a/test/groups/rotation_translation_action.jl +++ b/test/groups/rotation_translation_action.jl @@ -1,5 +1,5 @@ -include("../utils.jl") +include("../header.jl") include("group_utils.jl") @testset "Rotation-translation action" begin diff --git a/test/groups/semidirect_product_group.jl b/test/groups/semidirect_product_group.jl index 49c24acdd3..83611ca9bd 100644 --- a/test/groups/semidirect_product_group.jl +++ b/test/groups/semidirect_product_group.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") include("group_utils.jl") @testset "Semidirect product group" begin diff --git a/test/groups/special_euclidean.jl b/test/groups/special_euclidean.jl index 0030a38b72..2820469949 100644 --- a/test/groups/special_euclidean.jl +++ b/test/groups/special_euclidean.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") include("group_utils.jl") using ManifoldsBase: VeeOrthogonalBasis diff --git a/test/groups/special_linear.jl b/test/groups/special_linear.jl index 107ee1f9cf..c16f508243 100644 --- a/test/groups/special_linear.jl +++ b/test/groups/special_linear.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") include("group_utils.jl") using NLsolve diff --git a/test/groups/special_orthogonal.jl b/test/groups/special_orthogonal.jl index 5ac62be630..32753dd0bf 100644 --- a/test/groups/special_orthogonal.jl +++ b/test/groups/special_orthogonal.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") include("group_utils.jl") using Manifolds: LeftForwardAction, RightBackwardAction diff --git a/test/groups/translation_action.jl b/test/groups/translation_action.jl index 1348759b93..75bcee6d93 100644 --- a/test/groups/translation_action.jl +++ b/test/groups/translation_action.jl @@ -1,5 +1,5 @@ -include("../utils.jl") +include("../header.jl") include("group_utils.jl") @testset "Translation action" begin diff --git a/test/groups/translation_group.jl b/test/groups/translation_group.jl index 457f4bcaa0..d941cc3e57 100644 --- a/test/groups/translation_group.jl +++ b/test/groups/translation_group.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") include("group_utils.jl") using Manifolds: LeftForwardAction, RightBackwardAction diff --git a/test/groups/validation_group.jl b/test/groups/validation_group.jl index 1c8db47dbb..e5853b8a0f 100644 --- a/test/groups/validation_group.jl +++ b/test/groups/validation_group.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") @testset "Group wrapped in ValidationManifold" begin G = SpecialOrthogonal(3) diff --git a/test/header.jl b/test/header.jl new file mode 100644 index 0000000000..bbffe9d9fc --- /dev/null +++ b/test/header.jl @@ -0,0 +1,24 @@ + +TEST_FLOAT32 = get(ENV, "MANIFOLDS_TEST_FLOAT32", false) +TEST_DOUBLE64 = get(ENV, "MANIFOLDS_TEST_FLOAT64", false) +TEST_STATIC_SIZED = get(ENV, "MANIFOLDS_TEST_STATIC_SIZED", false) +TEST_GROUP = get(ENV, "MANIFOLDS_TEST_GROUP", "all") + +using Manifolds +using ManifoldsBase +using ManifoldsBase: number_of_coordinates, TypeParameter +import ManifoldsBase: active_traits, merge_traits + +using ManifoldDiff + +using LinearAlgebra +using Distributions +using DoubleFloats +using Quaternions +using Random +using StaticArrays +using Statistics +using StatsBase +using Test +using Graphs +using SimpleWeightedGraphs diff --git a/test/manifolds/centered_matrices.jl b/test/manifolds/centered_matrices.jl index ae63d1f5f9..8276a9bb40 100644 --- a/test/manifolds/centered_matrices.jl +++ b/test/manifolds/centered_matrices.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") @testset "CenteredMatrices" begin M = CenteredMatrices(3, 2) diff --git a/test/manifolds/cholesky_space.jl b/test/manifolds/cholesky_space.jl index 3fe165f654..d227c06ad5 100644 --- a/test/manifolds/cholesky_space.jl +++ b/test/manifolds/cholesky_space.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") @testset "Cholesky Space" begin M = Manifolds.CholeskySpace(3) diff --git a/test/manifolds/circle.jl b/test/manifolds/circle.jl index bc829fb91f..8296554eb0 100644 --- a/test/manifolds/circle.jl +++ b/test/manifolds/circle.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") using Manifolds: TFVector, CoTFVector diff --git a/test/manifolds/elliptope.jl b/test/manifolds/elliptope.jl index e36fae782f..465f4fb162 100644 --- a/test/manifolds/elliptope.jl +++ b/test/manifolds/elliptope.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") @testset "Elliptope" begin M = Elliptope(4, 2) diff --git a/test/manifolds/essential_manifold.jl b/test/manifolds/essential_manifold.jl index a05e3edd98..02bbba2a7f 100644 --- a/test/manifolds/essential_manifold.jl +++ b/test/manifolds/essential_manifold.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") @testset "Essential manifold" begin M = EssentialManifold() diff --git a/test/manifolds/euclidean.jl b/test/manifolds/euclidean.jl index e83572c67e..64e856177a 100644 --- a/test/manifolds/euclidean.jl +++ b/test/manifolds/euclidean.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") using Manifolds: induced_basis using FiniteDifferences diff --git a/test/manifolds/fiber.jl b/test/manifolds/fiber.jl index 8bf9253d09..640836b455 100644 --- a/test/manifolds/fiber.jl +++ b/test/manifolds/fiber.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") using RecursiveArrayTools diff --git a/test/manifolds/fiber_bundle.jl b/test/manifolds/fiber_bundle.jl index 9950c1ac67..3e2e49a653 100644 --- a/test/manifolds/fiber_bundle.jl +++ b/test/manifolds/fiber_bundle.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") using RecursiveArrayTools diff --git a/test/manifolds/fixed_rank.jl b/test/manifolds/fixed_rank.jl index ef128f8e85..4536e4e66c 100644 --- a/test/manifolds/fixed_rank.jl +++ b/test/manifolds/fixed_rank.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") @testset "fixed Rank" begin M = FixedRankMatrices(3, 2, 2) diff --git a/test/manifolds/generalized_grassmann.jl b/test/manifolds/generalized_grassmann.jl index 243b3af019..0f7850daa2 100644 --- a/test/manifolds/generalized_grassmann.jl +++ b/test/manifolds/generalized_grassmann.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") @testset "Generalized Grassmann" begin @testset "Real" begin diff --git a/test/manifolds/generalized_stiefel.jl b/test/manifolds/generalized_stiefel.jl index 9dc195e0e7..ebfce1d7fe 100644 --- a/test/manifolds/generalized_stiefel.jl +++ b/test/manifolds/generalized_stiefel.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") @testset "Generalized Stiefel" begin @testset "Real" begin diff --git a/test/manifolds/graph.jl b/test/manifolds/graph.jl index 73f0cd5c12..4e08759f52 100644 --- a/test/manifolds/graph.jl +++ b/test/manifolds/graph.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") @testset "Graph AbstractManifold" begin M = Euclidean(2) diff --git a/test/manifolds/grassmann.jl b/test/manifolds/grassmann.jl index 500ad62f5a..9f6827b274 100644 --- a/test/manifolds/grassmann.jl +++ b/test/manifolds/grassmann.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") @testset "Grassmann" begin @testset "Real" begin diff --git a/test/manifolds/hyperbolic.jl b/test/manifolds/hyperbolic.jl index 887627371c..f4970ca3d1 100644 --- a/test/manifolds/hyperbolic.jl +++ b/test/manifolds/hyperbolic.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") @testset "Hyperbolic Space" begin M = Hyperbolic(2) diff --git a/test/manifolds/lorentz.jl b/test/manifolds/lorentz.jl index 59e0362818..d61cc8c32b 100644 --- a/test/manifolds/lorentz.jl +++ b/test/manifolds/lorentz.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") @testset "Lorentz Manifold" begin M = Lorentz(3) diff --git a/test/manifolds/multinomial_doubly_stochastic.jl b/test/manifolds/multinomial_doubly_stochastic.jl index dd48083f72..22e55e77d9 100644 --- a/test/manifolds/multinomial_doubly_stochastic.jl +++ b/test/manifolds/multinomial_doubly_stochastic.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") @testset "Multinomial doubly stochastic Matrices" begin M = MultinomialDoubleStochastic(3) diff --git a/test/manifolds/multinomial_matrices.jl b/test/manifolds/multinomial_matrices.jl index c04d07410f..f23fa4e760 100644 --- a/test/manifolds/multinomial_matrices.jl +++ b/test/manifolds/multinomial_matrices.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") @testset "MultinomialMatrices manifold" begin M = MultinomialMatrices(3, 2) diff --git a/test/manifolds/multinomial_symmetric.jl b/test/manifolds/multinomial_symmetric.jl index 58450b5bac..fcf0a2360e 100644 --- a/test/manifolds/multinomial_symmetric.jl +++ b/test/manifolds/multinomial_symmetric.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") @testset "Multinomial symmetric matrices" begin M = MultinomialSymmetric(3) diff --git a/test/manifolds/oblique.jl b/test/manifolds/oblique.jl index 4f51907aea..b29678e972 100644 --- a/test/manifolds/oblique.jl +++ b/test/manifolds/oblique.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") @testset "Oblique manifold" begin M = Oblique(3, 2) diff --git a/test/manifolds/positive_numbers.jl b/test/manifolds/positive_numbers.jl index c914ba0940..350e3d0373 100644 --- a/test/manifolds/positive_numbers.jl +++ b/test/manifolds/positive_numbers.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") @testset "Positive Numbers" begin M = PositiveNumbers() diff --git a/test/manifolds/power_manifold.jl b/test/manifolds/power_manifold.jl index bace6ba9b7..192df1dced 100644 --- a/test/manifolds/power_manifold.jl +++ b/test/manifolds/power_manifold.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") using HybridArrays, Random using StaticArrays: Dynamic diff --git a/test/manifolds/probability_simplex.jl b/test/manifolds/probability_simplex.jl index d2b6a5445d..e82af8b304 100644 --- a/test/manifolds/probability_simplex.jl +++ b/test/manifolds/probability_simplex.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") @testset "Probability simplex" begin M = ProbabilitySimplex(2) diff --git a/test/manifolds/product_manifold.jl b/test/manifolds/product_manifold.jl index 5bbf9cd3cf..9f12478ea0 100644 --- a/test/manifolds/product_manifold.jl +++ b/test/manifolds/product_manifold.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") using RecursiveArrayTools: ArrayPartition diff --git a/test/manifolds/projective_space.jl b/test/manifolds/projective_space.jl index 140da634cc..8a843d6096 100644 --- a/test/manifolds/projective_space.jl +++ b/test/manifolds/projective_space.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") @testset "ProjectiveSpace" begin @testset "Real" begin diff --git a/test/manifolds/quotient_manifold.jl b/test/manifolds/quotient_manifold.jl index 36f482439f..b1d6a2b084 100644 --- a/test/manifolds/quotient_manifold.jl +++ b/test/manifolds/quotient_manifold.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") struct DummyManifold <: AbstractManifold{ℝ} end struct DummyTotalSpace <: AbstractManifold{ℝ} end diff --git a/test/manifolds/rotations.jl b/test/manifolds/rotations.jl index 4a276b8def..dfd4aee46e 100644 --- a/test/manifolds/rotations.jl +++ b/test/manifolds/rotations.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") @testset "Rotations" begin M = Rotations(2) diff --git a/test/manifolds/shape_space.jl b/test/manifolds/shape_space.jl index 777b298914..0873fe75ca 100644 --- a/test/manifolds/shape_space.jl +++ b/test/manifolds/shape_space.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") @testset "KendallsPreShapeSpace" begin M = KendallsPreShapeSpace(2, 3) diff --git a/test/manifolds/skewhermitian.jl b/test/manifolds/skewhermitian.jl index 7fd5a7600e..6db2139ad5 100644 --- a/test/manifolds/skewhermitian.jl +++ b/test/manifolds/skewhermitian.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") @testset "SkewSymmetricMatrices" begin @test SkewSymmetricMatrices(3) === SkewHermitianMatrices(3) diff --git a/test/manifolds/spd_fixed_determinant.jl b/test/manifolds/spd_fixed_determinant.jl index 21f01506fa..74c8f39ca7 100644 --- a/test/manifolds/spd_fixed_determinant.jl +++ b/test/manifolds/spd_fixed_determinant.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") @testset "Isochoric matrices" begin M = SPDFixedDeterminant(2, 1.0) diff --git a/test/manifolds/spectrahedron.jl b/test/manifolds/spectrahedron.jl index ffbf6290f4..dd5737bc00 100644 --- a/test/manifolds/spectrahedron.jl +++ b/test/manifolds/spectrahedron.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") @testset "Spectrahedron" begin M = Spectrahedron(4, 2) diff --git a/test/manifolds/sphere.jl b/test/manifolds/sphere.jl index 3c04cb7be2..9031742fb2 100644 --- a/test/manifolds/sphere.jl +++ b/test/manifolds/sphere.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") using Manifolds: induced_basis using ManifoldsBase: TFVector diff --git a/test/manifolds/sphere_symmetric_matrices.jl b/test/manifolds/sphere_symmetric_matrices.jl index 255a35e0bc..f5d8e02779 100644 --- a/test/manifolds/sphere_symmetric_matrices.jl +++ b/test/manifolds/sphere_symmetric_matrices.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") @testset "SphereSymmetricMatrices" begin M = SphereSymmetricMatrices(3) diff --git a/test/manifolds/stiefel.jl b/test/manifolds/stiefel.jl index 6154ce2a28..d075384a36 100644 --- a/test/manifolds/stiefel.jl +++ b/test/manifolds/stiefel.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") @testset "Stiefel" begin @testset "Real" begin diff --git a/test/manifolds/symmetric.jl b/test/manifolds/symmetric.jl index 5e0ce75a1e..79a164dc97 100644 --- a/test/manifolds/symmetric.jl +++ b/test/manifolds/symmetric.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") @testset "SymmetricMatrices" begin M = SymmetricMatrices(3, ℝ) diff --git a/test/manifolds/symmetric_positive_definite.jl b/test/manifolds/symmetric_positive_definite.jl index e8d0e6c091..b01662de22 100644 --- a/test/manifolds/symmetric_positive_definite.jl +++ b/test/manifolds/symmetric_positive_definite.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") @testset "Symmetric Positive Definite Matrices" begin M1 = SymmetricPositiveDefinite(3) diff --git a/test/manifolds/symmetric_positive_semidefinite_fixed_rank.jl b/test/manifolds/symmetric_positive_semidefinite_fixed_rank.jl index 83eae0b079..d0e7e4fd79 100644 --- a/test/manifolds/symmetric_positive_semidefinite_fixed_rank.jl +++ b/test/manifolds/symmetric_positive_semidefinite_fixed_rank.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") @testset "Symmetric Positive Semidefinite Matrices of Fixed Rank" begin @testset "Real Matrices" begin diff --git a/test/manifolds/symplectic.jl b/test/manifolds/symplectic.jl index af4cd95cd9..99558d9e16 100644 --- a/test/manifolds/symplectic.jl +++ b/test/manifolds/symplectic.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") using FiniteDifferences using Manifolds: RiemannianProjectionBackend using ManifoldDiff diff --git a/test/manifolds/symplecticstiefel.jl b/test/manifolds/symplecticstiefel.jl index f54f55d128..92f43c2d2b 100644 --- a/test/manifolds/symplecticstiefel.jl +++ b/test/manifolds/symplecticstiefel.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") using FiniteDifferences using Manifolds: RiemannianProjectionBackend using ManifoldDiff diff --git a/test/manifolds/torus.jl b/test/manifolds/torus.jl index ddab72ceef..78abc15313 100644 --- a/test/manifolds/torus.jl +++ b/test/manifolds/torus.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") @testset "Torus" begin M = Torus(2) diff --git a/test/manifolds/tucker.jl b/test/manifolds/tucker.jl index 762662cbcb..a8b6e131ba 100644 --- a/test/manifolds/tucker.jl +++ b/test/manifolds/tucker.jl @@ -1,5 +1,5 @@ using ManifoldsBase: LinearAlgebra -include("../utils.jl") +include("../header.jl") @testset "Tucker" begin n⃗ = (4, 5, 6) diff --git a/test/manifolds/unitary_matrices.jl b/test/manifolds/unitary_matrices.jl index 6584e8b48e..4683363658 100644 --- a/test/manifolds/unitary_matrices.jl +++ b/test/manifolds/unitary_matrices.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") using Quaternions diff --git a/test/manifolds/vector_bundle.jl b/test/manifolds/vector_bundle.jl index 370aacbafa..c0d7d0cae6 100644 --- a/test/manifolds/vector_bundle.jl +++ b/test/manifolds/vector_bundle.jl @@ -1,4 +1,4 @@ -include("../utils.jl") +include("../header.jl") using RecursiveArrayTools diff --git a/test/metric.jl b/test/metric.jl index b9fd75b17a..6441406310 100644 --- a/test/metric.jl +++ b/test/metric.jl @@ -6,7 +6,7 @@ import ManifoldsBase: default_retraction_method import Manifolds: solve_exp_ode using Manifolds: InducedBasis, connection, get_chart_index, induced_basis, mean!, median! using ManifoldDiff: FiniteDifferencesBackend -include("utils.jl") +include("header.jl") struct TestEuclidean{N} <: AbstractManifold{ℝ} end struct TestEuclideanMetric <: AbstractMetric end diff --git a/test/notation.jl b/test/notation.jl index 294cc39a7c..f9d9a8f9a2 100644 --- a/test/notation.jl +++ b/test/notation.jl @@ -1,4 +1,4 @@ -include("utils.jl") +include("header.jl") @testset "Test Notation" begin M = Sphere(2) diff --git a/test/recipes.jl b/test/recipes.jl index f595fa3044..b5af2da28e 100644 --- a/test/recipes.jl +++ b/test/recipes.jl @@ -1,6 +1,6 @@ using RecipesBase, Plots, Colors #using VisualRegressionTests, -include("utils.jl") +include("header.jl") # Note that the `false`s avoid popups and the tests directly fail. # If you have changed something and need to recreate the reference in the test avoids to start Gtk diff --git a/test/runtests.jl b/test/runtests.jl index afb113cc85..7a8e331b10 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,11 +1,16 @@ -include("utils.jl") +include("header.jl") @info "Manifolds.jl Test settings:\n\n" * "Testing Float32: $(TEST_FLOAT32)\n" * "Testing Double64: $(TEST_DOUBLE64)\n" * "Testing Static: $(TEST_STATIC_SIZED)\n\n" * "Test group: $(TEST_GROUP)\n\n" * - "These settings are stored in environment variables, see in test/utils.jl" + "These settings are stored in environment variables, see in test/header.jl" + +function include_test(path) + @info "Testing $path" + @time include(path) # show basic timing, (this will print a newline at end) +end @testset "Manifolds.jl" begin if TEST_GROUP ∈ ["all", "test_manifolds"] diff --git a/test/statistics.jl b/test/statistics.jl index 160537bc00..7cbb10b753 100644 --- a/test/statistics.jl +++ b/test/statistics.jl @@ -1,4 +1,4 @@ -include("utils.jl") +include("header.jl") using StatsBase: AbstractWeights, pweights using Random: GLOBAL_RNG, seed! import ManifoldsBase: diff --git a/test/utils.jl b/test/utils.jl deleted file mode 100644 index 6e53f06d56..0000000000 --- a/test/utils.jl +++ /dev/null @@ -1,50 +0,0 @@ -TEST_FLOAT32 = get(ENV, "MANIFOLDS_TEST_FLOAT32", false) -TEST_DOUBLE64 = get(ENV, "MANIFOLDS_TEST_FLOAT64", false) -TEST_STATIC_SIZED = get(ENV, "MANIFOLDS_TEST_STATIC_SIZED", false) -TEST_GROUP = get(ENV, "MANIFOLDS_TEST_GROUP", "all") - -using Manifolds -using ManifoldsBase -using ManifoldsBase: number_of_coordinates, TypeParameter -import ManifoldsBase: active_traits, merge_traits - -using ManifoldDiff - -using LinearAlgebra -using Distributions -using DoubleFloats -using Quaternions -using Random -using StaticArrays -using Statistics -using StatsBase -using Test -using Graphs -using SimpleWeightedGraphs - -function include_test(path) - @info "Testing $path" - @time include(path) # show basic timing, (this will print a newline at end) -end - -function our_ambiguities(m=Base) - ambigs = Test.detect_ambiguities(m) - modules_we_care_about = - [Base, LinearAlgebra, Manifolds, ManifoldsBase, StaticArrays, Statistics, StatsBase] - our_ambigs = filter(ambigs) do (m1, m2) - we_care = m1.module in modules_we_care_about && m2.module in modules_we_care_about - return we_care && (m1.module === Manifolds || m2.module === Manifolds) - end - return our_ambigs -end - -""" - has_type_in_signature(sig, T) - Test whether the signature `sig` has an argument of type `T` as one of its paramaters -""" -function has_type_in_signature(sig, T::Type) - return any(map(Base.unwrap_unionall(sig.sig).parameters) do x - xw = Base.rewrap_unionall(x, sig.sig) - return (xw isa Type ? xw : xw.T) <: T - end) -end