A Test suite

The submodule Manifolds.Test provides functions to test mathematical properties of functions defined for a manifold according to the API from ManifoldsBase.jl.

Manifolds.Test β€” Module
Manifolds.Test

The module Manifolds.Test contains functions to test functions from Manifolds.jl. Most functionality is provided only when Test.jl is loaded as well, i.e. populated with methods by the extension.

The test functions provided are mean to verify that the defined functions on a specific manifold behave as expected, for example that an allocating and in-place version of a function give the same result, or that for example the exponential map computes a point on the manifold, and calling the logarithmic map on the result yields the original tangent vector again, for tangent vectors within the injectivity radius.

In general for every function defined in the API for manifolds, this module shall provide a test function with

  • the same name prefixed by test_
  • the same function arguments as the original function
  • keyword arguments to control which tests to perform
source

The main function is

Manifolds.Test.test_manifold β€” Function
test_manifold(G::AbstractManifold, properties::Dict, expectations::Dict)

Test the AbstractManifold $\mathcal M$ based on a Dict of properties and a Dict of expectations.

Three functions are expected to be defined (without explicitly being passed in the properties): is_point(M, p), is_vector(M, p, X), and isapprox(M, p, q) / isapprox(M, p, X, Y), since these are essential for verifying results.

From the following properties, the two often expected to be defined are :Points and :Vectors, which should contain at least two points and two tangent vectors, respectively.

Possible properties are

  • :Aliased is a boolean (same as :Mutating by default) whether to test the mutating variants with aliased input
  • :Bases is a vector of bases, which can be used to test basis related functions, one basis for each entry in :Coordinates
  • :Covectors is a vector of covectors, which should be in the cotangent space of the correspondinig point entry in :Points
  • :Coordinates is a vector of coordinates, which can be used to test coordinate related functions, one coordinate vector for each entry in :Bases
  • :EmbeddedPoints is a vector of points in the embedding space of M, to test project
  • :EmbeddedVectors is a vector of tangent vectors in the embedding space of M, to test project
  • :Functions is a vector of all defined functions for M note a test is activated by the function (like exp), adding the mutating function (like exp!) overwrites the global default (see :Mutating) to true.
  • :GeodesicMaxTime is a real number indicating the time parameter to use when testing geodesic
  • :GeodesicSamples is an integer indicating the number of samples to use when testing geodesic (defaults to 10)
  • :InvalidPoints is a vector of points that are not on M, e.g. to test is_point
  • :InvalidVectors is a vector of tangent vectors that are not in the tangent space of the first point from :Points
  • :InverseRetractionMethods is a vector of inverse retraction methods to test on M these should have the same order as :RetractionMethods (use missing for skipping one)
  • :Mutating is a boolean (true by default) whether to test the mutating variants of functions or not. when setting this to false, you can still activate single functions mutation checks by adding the mutating function to :Functions
  • :Name is a name of the test. If not provided, defaults to "$M"
  • :NormalVectors is a vector of normal vectors, where each should be in the normal space of the corresponding point entries in :Points
  • :Points is a vector of at least 2 points on M, which should not be the same point
  • :RetractionMethods is a vector of retraction methods to test on M these should have the same order as :InverseRetractionMethods (use missing for skipping one)
  • :Rng is a random number generator to use for generating random points/vectors if needed
  • :Seed is a seed to use for generating random points/vectors if needed
  • :Vectors is a vector of at least 2 tangent vectors, which should be in the tangent space of the correspondinig point entries in :Points
  • :VectorTransportMethods is a vector of vector transport methods to test on M
  • :TestMidpointSymmetry is a boolean (true by default) whether to test the symmetry property of the midpoint function
  • :TestInfo is a boolean (true by default) whether to test that whether error=:info in verification functions issues info messages.
  • :TestWarn is a boolean (true by default) whether to test that whether error=:warn in verification functions issues warning.

Possible entries of the expectations dictionary are

  • any function tested to provide their expected resulting value, e.g. exp => p for the result of exp(M, p, X)
  • for retractions, inverse retractions, and vector transports, the key is a tuple of the function and the method, e.g. (retract, method) => q
  • for embed, and project, the key is a tuple of the function and :Point or :Vector, e.g. `(embed, :Point) of expected (embedded) points or vectors, omitting that symbol is interpreted as the expected point.
  • for get_basis, the key is a tuple of the function and the basis, e.g. (get_basis, B) => ... to the expexted basis
  • for get_coordinates the key is a tuple of the function and the basis, e.g. (get_coordinates, B) => c
  • for get_vector the key is a tuple of the function, the coordinate vector, and the basis, e.g. (get_vector, c, B) => X
  • for get_vectors the key is a tuple of the function and the basis, e.g. (get_vectors, B) => :Symbol where
    • :Orthogonal tests for orthogonality
    • :Orthonormal tests additionally to the previous for unit length
    For any basis this test calls get_basis on any provided basis, if that function is available.
  • for is_default_metric, the value is the default metric
  • :atol => 0.0 a global absolute tolerance
  • :atols -> Dict() a dictionary function -> atol for tolerances of specific function tested.
  • :Types -> Dict() a dictionary function -> Type for specifying expected types of results of specific functions, for example manifold_dimension => Int.
  • :IsPointErrors is a vector of expected error types for each invalid point provided in :InvalidPoints, use missing to skip testing for errors for a specific point.
  • :IsVectorErrors is a vector of expected error types for each invalid vector provided in :InvalidVectors, use missing to skip testing for errors for a specific vector.
  • :IsVectorBasepointError is an expected error type when the base point is invalid e.g. for is_vector
source

Functions for individual tests

Manifolds.Test.test_copy β€” Function
Manifolds.Test.test_copy(M, p, X;
    name = "copying on $M for $(typeof(p)) points",
    kwargs...
)

Test copy(M, p) and copy(M, p, X) on a manifold M.

  • that the copied point/vector is a valid point/vector on the manifold / tangent space
  • that the copied point/vector matches the original point/vector but is new memory
source
Manifolds.Test.test_copyto β€” Function
Manifolds.Test.test_copyto(M, p, X;
    name = "copying on $M for $(typeof(p)) points",
    kwargs...
)

Test copyto!(M, q, p) and copyto!(M, Y, p, X) on a manifold M.

  • that the copied point/vector is a valid point/vector on the manifold / tangent space
  • that the copied point/vector matches the original point/vector and is the same memory

Note that since this function does not modify its input, is is called test_copyto.

source
Manifolds.Test.test_default_retraction β€” Function
Manifolds.Test.test_default_retraction_method(
    M, T=missing;
    expected_value = NoExpectation(),
    expected_type = isexpected(expected_value) ? Expect(typeof(expect(expected_value))) : NoExpectation(),
    name = "default_retraction_method on $M $(ismissing(T) ? "" : "for type $T")",
)

Test the default_retraction_method on manifold M.

  • that it returns an AbstractRetractionMethod
  • that the result matches expected_value, if given
  • that the result is of type expected_type, if given, defaults to the type of the value
source
Manifolds.Test.test_default_inverse_retraction β€” Function
Manifolds.Test.test_default_inverse_retraction_method(
    M, T=missing;
    expected_value = NoExpectation(),
    expected_type = !isexpected(expected_value) ? NoExpectation() : typeof(expected_value),
    name = "default_inverse_retraction_method on $M $(ismissing(T) ? "" : "for type $T")",
)

Test the default_inverse_retraction_method on manifold M.

  • that it returns an AbstractInverseRetractionMethod
  • that the result matches expected_value, if given
  • that the result is of type expected_type, if given, defaults to the type of the value
source
Manifolds.Test.test_default_vector_transport_method β€” Function
Manifolds.Test.test_default_vector_transport_method(
    M, T=missing;
    expected_value = NoExpectation(),
    expected_type = isexpected(expected_value) ? Expect(typeof(expect(expected_value))) : NoExpectation(),
    name = "default_vector_transport_method on $M $(ismissing(T) ? "" : "for type $T")",
)

Test the default_vector_transport_method on manifold M.

  • that it returns an AbstractVectorTransportMethod
  • that the result matches expected_value, if given
  • that the result is of type expected_type, if given, defaults to the type of the value
source
Manifolds.Test.test_distance β€” Function
Manifolds.Test.test_distance(
    M, p, q;
    available_functions=[], expected_value=NoExpectation(),
    name = "Distance on $M between $(typeof(p)) points",
    kwargs...
)

Test the distance function on manifold M between points p and q.

  • that the result is a nonnegative number
  • that the distance from p to p is zero
  • that the distance is symmetric
  • that the result matches expected_value, if given
  • that the distance is equal to the norm of the logarithmic map (if log and norm are available) (only performed if either injectivity_radius is not available or the points are within)
source
Manifolds.Test.test_exp β€” Function
Manifolds.Test.test_exp(
    M, p, X, t=1.0;
    available_functions=[], expected_value=NoExpectation(), test_mutating=true,
    test_log = (log in available_functions),
    test_fused = true,
    test_injectivity_radius = (injectivity_radius in available_functions),
    name = "Exponential map on $M for $(typeof(p)) points",
    kwargs...
)

Test the exponential map on manifold M at point p with tangent vector X.

  • that the result is a valid point on the manifold
  • that the result matches expected_value, if given
  • that the mutating version exp! matches the non-mutating version, (if activated)
  • that exp! works on aliased in put (p=q) (if activated for mutating)
  • that the logarithmic map inverts the exponential map (if activated)

(only performed if either injectivity_radius is not available or X is within)

  • that the fused version exp_fused(M, p, t, X) matches the non-fused version (if activated)
source
Manifolds.Test.test_embed β€” Function
Manifolds.Test.test_embed(
    M, p, X=missing;
    available_functions=[],
    expected_point=NoExpectation(),
    expected_vector=NoExpectation(),
    test_aliased=true,
    test_mutating=true,
    name = "Embedding on $M for $(typeof(p)) points",
    kwargs...
)

Test the embed(M, p) and embed(M, p, X) to embed points and tangent vectors (if not missing).

Besides a simple call of embed (for both variants) the following ones are prefoemd if get_embedding is available:

  • that the embedded point is a valid point on the embedding manifold
  • that the embedded vector is a valid tangent vector on the embedding manifold (if get_embedding is available and X is not missing)
  • that the result matches expected_point and expected_vector, respectively, if given
  • that the projection inverts the embedding (if project is available)
  • that the mutating version embed! produces the same result(s) (if activated and get_embedding is available)
  • that embed! works on aliased input (p=q or X=Y) (if activated and p/q or X/Y are of same type)
source
Manifolds.Test.test_embed_project β€” Function
Manifolds.Test.test_embed_project(
    M, ap, aX = missing;
    available_functions=[],
    expected_point=NoExpectation(),
    expected_vector=NoExpectation(),
    test_aliased=true,
    test_mutating=true,
    name = "Projection on $M for $(typeof(q)) points",
    kwargs...
)

Test the p=embed_project(M, ap) and embed_project(M, p, aX) to project points and tangent vectors (if not aX is not missing) after embedding them. Besides a simple call of embed_project (for both variants) the following tests are performed

  • that the projected point is a valid point on the manifold
  • that the projected vector is a valid tangent vector on the manifold
  • that the result matches expected_point and expected_vector, respectively, if given
  • that the mutating version embed_project! produces the same result(s) (if activated)
  • that embed_project! works on aliased input (p=q or X=Y) (if activated and p/q or X/Y are of same type)
source
Manifolds.Test.test_flat β€” Function
Manifolds.Test.test_flat(M, p, X;
    available_functions = [],
    expected_value= NoExpectation(),
    name = "Flat on $M for $(typeof(p)) points",
    kwargs...
)

Test the flat operation on manifold M at point p with tangent vector X.

  • (we can not yet test valid cotangent vectors)
  • that the result matches expected_value, if given
  • that sharp is the inverse
  • that mutating version flat! matches non-mutating version (if activated)
source
Manifolds.Test.test_injectivity_radius β€” Function
Manifolds.Test.test_injectority_radius(M, p = missing;
    expected_value = NoExpectation(),
    expected_global_value = NoExpectation(),
    retraction_method = missing,
    name = "Injectivity radius on $M at point $(ismissing(p) ? "" : "$typeof(p)")) and $(retraction_method)",
    kwargs...
)

Test the injectivity radius on manifold M at point p.

  • that the result is a nonnegative real number
  • that the result matches expected_value, if given
  • if a point p is given, that the result is larger or equal to the global injectivity radius
source
Manifolds.Test.test_inner β€” Function
Manifolds.Test.test_inner(M, p, X, Y;
    available_functions=[], expected_value = NoExpectation(),
    name = "Inner product on $M at point $(typeof(p))",
    test_norm = (norm in available_functions),
    kwargs...
)

Test the inner product on the manifold M at point p for tangent vectors X and Y.

  • that the result is a real number
  • that the result matches expected_value, if given
  • that the inner product of X with itself is non negative
  • that the inner product of X with itself is the same as its norm squared (if activated)
source
Manifolds.Test.test_inverse_retract β€” Function
Manifolds.Test.test_inverse_retraction(
    M, p, q, m::AbstractInverseRetractionMethod;
    available_functions=[],
    expected_value = NoExpectation(),
    name = "Inverse retraction $m on $M at point $(typeof(p))",
    retraction_method = missing,
    test_mutating = true,
    test_retraction = (retract in available_functions) && !ismissing(retraction_method),
    kwargs...
)

Test the inverse retraction method m on manifold M at point p towards point q.

  • that the result is a valid tangent vector at p on the manifold
  • that the result matches expected_value, if given
  • that the mutating version inverse_retract! matches the non-mutating version, (if activated)
  • that the retraction inverts the inverse retraction (if activated)
source
Manifolds.Test.test_is_flat β€” Function
Manifolds.Test.test_is_flat(
M;
expected_value = NoExpectation(),
name = "is_flat on $M",
)

Test the function is_flat on manifold M. Since it returns a boolean, there is also only the check that it agrees with the expected_value, if given.

source
Manifolds.Test.test_is_point β€” Function
Manifolds.Test.is_point(
    M, p qs...;
    errors = [],
    name = "is_point on $M for $(typeof(p)) points",
    test_warn = true,
    test_info = true,
    kwargs...
)

Test the function is_point on for point p on manifold M.

  • that for p it returns true.
  • that for each q in qs it
    • returns false
    • issues a warning (if activated)
    • isues an info message (if activated)
    • throws the corresponding error from error_types (if not missing)
source
Manifolds.Test.test_is_vector β€” Function
Manifolds.Test.test_is_vector(
    M, p, X, Ys...;
    basepoint_error = missing,
    check_basepoint = true,
    errors = [],
    name = "is_vector on $M for $(typeof(p)) points",
    test_warn = true,
    test_info = true,
    q = missing,
    kwargs...
)

Test the function is_vector on manifold M at point p for tangent vector X.

  • that for X it returns true.
  • that for each Y in Ys it
    • returns false
    • issues a warning (if activated)
    • isues an info message (if activated)
    • throws the corresponding error from error_types (if not missing)
  • if check_basepoint is true, then it checks that
    • for p this still returns true
    • for the base point q it
      • returns false
      • issues a warning (if activated)
      • isues an info message (if activated)
      • throws the corresponding error from error_basepoint (if activated)
source
Manifolds.Test.test_geodesic β€” Function
Manifolds.Test.test_geodesic(M, p, X, t=1.0;
    available_functions=[],
    expected_value = NoExpectation(),
    N = 10,
    name = "Geodesic on $M for $(typeof(p)) points",
    kwargs...
)

Test the geodesic on manifold M at point p with tangent vector X at time t.

  • that at time 0 the geodesic returns p
  • that the function Ξ³ = geodesic(M, p, X) is consistent with evaluation at 0 and t`
  • that the result is a valid point on the manifold
  • that the result matches expected_value, if given
  • that the geodesic has constant speed (if activated) using N samples and each of the segments is of length equal to the average speed, i.e. t*norm(M, p, X) / (N-1)
source
Manifolds.Test.test_get_basis β€” Function
Manifolds.Test.test_get_basis(
    M, p, b::AbstractBasis;
    expected_value = NoExpectation(),
    expected_type = isexpected(expected_value) ? Expect(typeof(expect(expected_value))) : Expect(CachedBasis),
    name = "get_basis on $M at point $(typeof(p)) for basis $(typeof(b))",
)

Test the get_basis on manifold M at point p for basis b.

  • that it returns a basis of type expected_type, which defaults to CachedBasis.
  • that the result matches expected_value, if given
source
Manifolds.Test.test_get_coordinates β€” Function
Manifolds.Test.test_get_coordinates(
    M, p, X, B;
    available_functions = [],
    expected_value = NoExpectation(),
    name = "get_coordinates on $M at point $(typeof(p))",
    test_mutating = true,
)

Test the get_coordinates on manifold M at point p for a tangent vector X and a basis B.

  • that the result is a valid coordinate vector, that is of correct length
  • that the result matches expected_value, if given
  • that the mutating version get_coordinates! matches the non-mutating version, (if activated)
  • that get_vector inverts get_coordinates (if activated)
source
Manifolds.Test.test_get_embedding β€” Function
Manifolds.Test.test_get_embedding(M, P=missing;
    expected_value = NoExpectation(),
    expected_type = isexpected(expected_value) ? Expect(typeof(expect(expected_value))) : NoExpectation(),
    name = "get_embedding on $M $(ismissing(P) ? "" : "for type $P")",
)

Test the get_embedding on manifold M.

  • that it returns an AbstractManifold.
  • that its type matches expected_type, if given, defaults to the type of the expected value
  • that the result matches expected_value, if given
source
Manifolds.Test.test_get_vector β€” Function
Manifolds.Test.test_get_vector(
    M, p, c, B;
    available_functions=[],
    expected_value = NoExpectation(),
    name = "get_vector on $M at point $(typeof(p))",
    test_mutating = true,
    kwargs...
)

Test the get_vector on manifold M at point p for a vector of coordinates c in basis B.

  • that the result is a valid tangent vector at p on the manifold
  • that the result matches expected_value, if given
  • that the mutating version get_vector! matches the non-mutating version, (if activated)
  • that get_coordinates inverts get_vector (if activated)
source
Manifolds.Test.test_get_vectors β€” Function
Manifolds.Test.test_get_vectors(
    M, p, b;
    available_functions=[],
    name = "get_vectors on $M at point $(typeof(p))",
    test_orthogonality = false,
    test_normality = false,
    kwargs...
)

Test the get_vectors on manifold M at point p for basis b, where the basis is assumed to come from a call to get_basis.

  • that there are as many vectors as the manifold dimension (if available)
  • that each vector is a valid tangent vector at p on the manifold
  • that the vectors are orthogonal (if activated)
  • that the vectors are normal (if activated)
source
Manifolds.Test.test_log β€” Function
Manifolds.Test.test_log(
    M, p, q;
    available_functions=[], expected_value=NoExpectation(), test_mutating=true,
    test_exp = (exp in available_functions),
    test_injectivity_radius = (injectivity_radius in available_functions),
    name = "Logarithmic map on $M for $(typeof(p)) points",
    kwargs...
)
Test the logarithmic map on manifold `M` at point `p` towards q

* that the result is a valid tangent vector at `p` on the manifold
* that the result matches `expected_value`, if given
* that the mutating version `log!` matches the non-mutating version, (if activated)
* that the exponential map inverts the logarithmic map (if activated)
(only performed if either `injectivity_radius` is not available or `X` is within)
source
Manifolds.Test.test_manifold_dimension β€” Function
test_manifold_dimension(
    M;
    expected_value = NoExpectation(),
    expected_type = Int,
    name = "Manifold dimension for $M",
)

Test that the dimension of the manifold M is consistent.

  • that the dimension is nonnegative
  • that it is an integer (of type expected_type, Int by default)
  • that it matches the expected value (if provided)
source
Manifolds.Test.test_manifold_volume β€” Function
Manifolds.Test.test_manifold_volume(
    M;
    expected_value = NoExpectation(),
    name = "Manifold volume for $M",
)

Test the volume of the manifold M.

  • that the volume is nonnegative
  • that it matches the expected value (if provided)
source
Manifolds.Test.test_mid_point β€” Function
Manifolds.Test.test_mid_point(M, p, q;
    available_functions=[],
    expected_value = NoExpectation(),
    test_aliased = true,
    test_mutating = true,
    test_symmetry = true,
    name = "Mid-point on $M between $(typeof(p)) points",
    kwargs...
)

Test the mid-point function on manifold M between points p and q.

  • that the result is a valid point on the manifold
  • that the result matches expected_value, if given
  • that the mid-point is symmetric (if activated)
  • that the distance from p and q to the mid-point is half the distance from p to q (if distance is present)
  • that the mutating version mid_point! matches the non-mutating version (if activated)
  • that mid_point! works on aliased in put (r=p or r=q) (if activated for mutating)
source
Manifolds.Test.test_norm β€” Function
Manifolds.Test.test_norm(M, p, X;
    available_functions = [], expected_value = NoExpectation(),
    name = "Norm on $M at point $(typeof(p))",
    test_inner = (inner in available_functions),
    kwargs...
)

Test the norm on the manifold M at point p for tangent vector X.

  • that the result is a real number
  • that the result matches expected_value, if given
  • that the norm of X with itself is non negative
  • that the inner product of X with itself is the same as its norm squared (if activated)
source
Manifolds.Test.test_parallel_transport β€” Function
Manifolds.Test.test_parallel_transport(
    M, p, X, q;
    available_functions=[],
    direction = (log in available_functions) ? log(M, p, q) : missing,
    expected_value=NoExpectation(),
    expected_value_direction=NoExpectation(),
    name = "Parallel transport on $M at point $(typeof(p))",
    test_aliased = true,
    test_mutating = true,
    kwargs...
)

Test the parallel transport on manifold M at point p with tangent vector X to a point q.

this defaults to testing parallel_transport_to, but can also be used to test parallel_transport_direction, by passing that function to the available_functions, using the direction argument. The direction has to be the one that transports X also to q.

  • that the result is a valid tangent vector at q on the manifold
  • that the result matches expected_value, if given
  • that the mutating version parallel_transport! matches the non-mutating version
  • that parallel_transport_to works on aliased in put (Y=X) (if activated)
  • that the direction of the transport is consistent with expected_direction, if given
  • that the mutating version parallel_transport_direction! matches the non-mutating version (if activated)
  • that parallel_transport_direction works on aliased in put (Y=X or Y=d) (if activated for mutating)
  • that both functions are consistent
source
Manifolds.Test.test_project β€” Function
Manifolds.Test.test_project(
    M, q, Y = missing;
    available_functions = [],
    expected_point = NoExpectation(),
    expected_vector = NoExpectation(),
    test_aliased = true,
    test_mutating = true,
    name = "Projection on $M for $(typeof(q)) points",
    kwargs...
)

Test the project(M, q) and project(M, q, Y) to project points and tangent vectors (if not missing).

Besides a simple call of project (for both variants) the following tests are performed

  • that the projected point is a valid point on the manifold
  • that the projected vector is a valid tangent vector on the manifold
  • that the result matches expected_point and expected_vector, respectively, if given
  • that the mutating version project! produces the same result(s) (if activated)
  • that project! works on aliased input (p=q or X=Y) (if activated and p/q or X/Y are of same type)
source
Manifolds.Test.test_rand β€” Function
Manifolds.Test.test_rand(M;
    vector_at = missing,
    seed = missing,
    test_mutating = true,
    rng = missing,
    name = "Random sampling on $M",
    kwargs...
)

Test the random sampling functions rand(M) and rand(M; vector_at=p (if vector_at is given) on manifold M.

  • that the result of rand(M) is a valid point on the manifold
  • that the result of rand(M; vector_at=p) is a valid tangent vector at p on the manifold (if vector_at is given)
  • that the mutating versions rand! match the non-mutating versions (if activated)
  • that the four mentioned functions also work with a seed upfront.
source
Manifolds.Test.test_repr β€” Function
Manifolds.Test.test_repr(
    M;
    expected_value = NoExpectation(),
    name = "(String) repr_esentation of $M",
)

Test that the default show method works as expected by calling repr(M).

source
Manifolds.Test.test_representation_size β€” Function
Manifolds.Test.test_representation_size(
    M;
    expected_value = NoExpectation(),
    name = "Representation size of $M",
)

Test the representation size of the manifold M.

  • that the result is tuple of nonnegative integers or nothing (if there is no reasonable representation)
  • that it matches the expected value (if provided)
source
Manifolds.Test.test_retract β€” Function
Manifolds.test.test_retract(
    M, p, X, m::AbstractRetractionMethod;
    available_functions=[],
    expected_value = NoExpectation(),
    inverse_retraction_method = missing,
name = "Retraction $m on $M at point $(typeof(p))",
    t = 1.0
    test_mutating = true,
    test_mutating = true,
    test_inverse_retraction = (inverse_retraction in available_functions) && !ismissing(inverse_retraction_method),
    kwargs...
)

Test the retraction method m on manifold M at point p with tangent vector X.

  • that the result is a valid point on the manifold
  • that the result matches expected_value, if given
  • that the mutating version retract! matches the non-mutating version, (if activated)
  • that retract! works on aliased in put (p=q) (if activated for mutating)
  • that the inverse retraction inverts the retraction (if activated)
  • that the fused version retract_fused(M, p, X, t, m) matches the non-fused version (if activated)
source
Manifolds.Test.test_sectional_curvature β€” Function
Manifolds.Test.test_sectional_curvature(
    M, p, X, Y;
    expected_value = NoExpectation(),
    expected_min = NoExpectation(),
    expected_max = NoExpectation(),
    name = "Sectional curvature on $M at point $(typeof(p))",
    kwargs...
)

Test the sectional curvature on manifold M at point p for tangent vectors X and Y.

  • that the result is a real number
  • that the result matches expected_value, if given
  • that the minimum sectional curvature at p is less than or equal to the sectional curvature
  • that the maximum sectional curvature at p is greater than or equal to the sectional curvature
  • that the minimum and maximum sectional curvatures match expected_min and expected_max, if given
source
Manifolds.Test.test_sharp β€” Function
Manifolds.Test.test_sharp(M, p, ΞΎ;
    available_functions=[],
    expected_value = NoExpectation(),
    name = "Sharp on $M for $(typeof(p)) points",
    kwargs...
)

Test the sharp operation on manifold M at point p with cotangent vector ΞΎ.

  • test that the result is a valid tangent vector at p on the manifold
  • that the result matches expected_value, if given
  • that flat is the inverse
  • that mutating version sharp! matches non-mutating version (if activated)
source
Manifolds.Test.test_shortest_geodesic β€” Function
Manifolds.Test.test_shortest_geodesic(M, p, q, t=1.0;
    available_functions=[],
    expected_value = NoExpectation(),
    N = 10,
    name = "Shortest geodesic on $M for $(typeof(p)) points",
    kwargs...
)

Test the geodesic on manifold M at point p with tangent vector X at time t.

  • that at time 0 the geodesic returns p, at time 2 it returns q
  • that the function Ξ³ = shortest_geodesic(M, p, X) is consistent with evaluation at 0, 1 and t`
  • that the result at t is a valid point on the manifold
  • that the geodesic has constant speed (if activated) using N samples and the approximated derivative via finite differences
  • that the geodesic is length minimizing, i.e. the sum of the segments is approximately equal to the distance from p to q (if activated)
source
Manifolds.Test.test_vector_transport β€” Function
Manifolds.Test.test_vector_transport(
    M, p, X, q, default_vector_transport_method(M);
    available_functions=[],
    direction = inverse_retract(M, p, q, default_inverse_retraction_method(M)),
    expected_value = NoExpectation(),
    expected_value_direction = NoExpectation(),
    test_aliased = true,
    test_mutating = true,
    name = "Vector transport method $(vector_transport_method) on $M at point $(typeof(p))",
    kwargs...
)

Test the vector transport on manifold M at point p with tangent vector X to a point q.

this defaults to testing vector_transport_to, but can also be used to test vector_transport_direction, by passing that function to the available_functions, using the direction argument. The direction has to be the one that transports X also to q.

  • that the result is a valid tangent vector at q on the manifold
  • that the result matches expected_value, if given
  • that the mutating version vector_transport! matches the non-mutating version
  • that vector_transport_to works on aliased in put (Y=X) (if activated)
  • that the direction of the transport is consistent with expected_direction, if given
  • that the mutating version vector_transport_direction! matches the non-mutating version (if activated)
  • that vector_transport_direction works on aliased in put (Y=X or Y=d) (if activated for mutating)
  • that both functions are consistent
source
Manifolds.Test.test_volume_density β€” Function
Manifolds.Test.test_volume_density(
    M, p, X;
    expected_value = NoExpectation(),
    name = "Manifold volume density for $M",
    kwargs...
)

Test the volume_density of the manifold M.

  • that it matches the expected value (if provided)
source
Manifolds.Test.test_Weingarten β€” Function
Manifolds.Test.Weingarten(
    M, p, X, V;
    expected_value = NoExpectation(),
    test_aliased = true,
    test_mutating = true,
    name = "Weingarten map on $M at point $(typeof(p))",
    kwargs...
)

Test the Weingarten map on manifold M at point p for tangent vector X and normal vector V.

  • that the result is a valid tangent vector at p on the manifold
  • that the result matches expected_value, if given
  • that the result is consistent with the mutating version weingarten! (if activated)
  • that Weingarten! works on aliased in put (Y=X) (if activated for mutating)
source
Manifolds.Test.test_zero_vector β€” Function
Manifolds.Test.test_zero_vector(M, p;
    available_functions=[],
    test_mutating = true,
    test_norm = (norm in available_functions),
    name = "Zero vector test on $M at point $(typeof(p))",
)

Test the zero vector on the manifold M at point p.

  • verify that it is a valid tangent vector
  • verify that its norm is zero (if provided)
  • verify that the mutating version zero_vector! matches the non-mutating version (if activated)
source

Internals to handle expectations

Manifolds.Test.Expect β€” Type
Expect{T} <: AbstractExpectation

A struct to hold expected values for tests of type T.

Fields

  • value::T the expected value

Constructor

Expect(value::T)
source
Manifolds.Test.expect β€” Function
expect(e::Union{Expect{T}, NoExpectation}) where T

Get the expected value if provided, error otherwise.

source

Former tests

Manifolds.find_eps β€” Function
Manifolds.find_eps(x...)

Find an appropriate tolerance for given points or tangent vectors, or their types.

Note

This function is soon deprecated and will be replaced by a more systematic way in Manifolds.Test

source
Manifolds.test_manifold β€” Function
Manifolds.test_manifold(M::AbstractManifold, pts::AbstractVector; kwargs...)

Test general properties of manifold M, given at least three different points that lie on it (contained in pts).

Note

This is an old an soon deprecated interface, the new one is Manifolds.Test.test_manifold.

Arguments

  • basis_has_specialized_diagonalizing_get = false: if true, assumes that DiagonalizingOrthonormalBasis given in basis_types has get_coordinates and get_vector that work without caching.
  • basis_types_to_from = (): basis types that will be tested based on get_coordinates and get_vector.
  • basis_types_vecs = () : basis types that will be tested based on get_vectors
  • default_inverse_retraction_method = ManifoldsBase.LogarithmicInverseRetraction(): default method for inverse retractions (log.
  • default_retraction_method = ManifoldsBase.ExponentialRetraction(): default method for retractions (exp).
  • exp_log_atol_multiplier = 0: change absolute tolerance of exp/log tests (0 use default, i.e. deactivate atol and use rtol).
  • exp_log_rtol_multiplier = 1: change the relative tolerance of exp/log tests (1 use default). This is deactivated if the exp_log_atol_multiplier is nonzero.
  • expected_dimension_type = Integer: expected type of value returned by manifold_dimension.
  • inverse_retraction_methods = []: inverse retraction methods that will be tested.
  • is_mutating = true: whether mutating variants of functions should be tested.
  • is_point_atol_multiplier = 0: determines atol of is_point checks.
  • is_tangent_atol_multiplier = 0: determines atol of is_vector checks.
  • has_get_embedding = false: whether the manifold has a specialized get_embedding(M, p) method (to test mutating embed!). This is experimental.
  • mid_point12 = test_exp_log ? shortest_geodesic(M, pts[1], pts[2], 0.5) : nothing: if not nothing, then check that mid_point(M, pts[1], pts[2]) is approximately equal to mid_point12. This is by default set to nothing if text_exp_log is set to false.
  • point_distributions = [] : point distributions to test.
  • rand_tvector_atol_multiplier = 0 : chage absolute tolerance in testing random vectors (0 use default, i.e. deactivate atol and use rtol) random tangent vectors are tangent vectors.
  • retraction_atol_multiplier = 0: change absolute tolerance of (inverse) retraction tests (0 use default, i.e. deactivate atol and use rtol).
  • retraction_rtol_multiplier = 1: change the relative tolerance of (inverse) retraction tests (1 use default). This is deactivated if the exp_log_atol_multiplier is nonzero.
  • retraction_methods = []: retraction methods that will be tested.
  • test_atlases = []: Vector or tuple of atlases that should be tested.
  • test_exp_log = true: if true, check that exp is the inverse of log.
  • test_injectivity_radius = true: whether implementation of injectivity_radius should be tested.
  • test_inplace = false : if true check if inplace variants work if they are activated, e.g. check that exp!(M, p, p, X) work if test_exp_log = true. This in general requires is_mutating to be true.
  • test_is_tangent: if true check that the default_inverse_retraction_method actually returns valid tangent vectors.
  • test_musical_isomorphisms = false : test musical isomorphisms.
  • test_mutating_rand = false : test the mutating random function for points on manifolds.
  • test_project_point = false: test projections onto the manifold.
  • test_project_tangent = false : test projections on tangent spaces.
  • test_representation_size = true : test representation size of points/tvectprs.
  • test_tangent_vector_broadcasting = true : test boradcasting operators on TangentSpace.
  • test_vector_spaces = true : test Vector bundle of this manifold.
  • test_default_vector_transport = false : test the default vector transport (usually parallel transport).
  • tvector_distributions = [] : tangent vector distributions to test.
  • vector_transport_methods = []: vector transport methods that should be tested.
  • vector_transport_inverse_retractions = [default_inverse_retraction_method for _ in 1:length(vector_transport_methods)]` inverse retractions to use with the vector transport method (especially the differentiated ones)
  • vector_transport_to = [ true for _ in 1:length(vector_transport_methods)]: whether to check the to variant of vector transport
  • vector_transport_direction = [ true for _ in 1:length(vector_transport_methods)]: whether to check the direction variant of vector transport
Note

This function is soon deprecated and will be replaced by a more systematic way in Manifolds.Test

source
Manifolds.test_parallel_transport β€” Function
Manifolds.test_parallel_transport(M,P; to=true, direction=true)

Generic tests for parallel transport on Mgiven at least two pointsin P.

The single functions to transport to (a point) or (in a) direction are sub-tests that can be activated by the keywords arguments

Note

This function is soon deprecated and will be replaced by a more systematic way in Manifolds.Test

source