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.TestThe 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
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
:Aliasedis a boolean (same as:Mutatingby default) whether to test the mutating variants with aliased input:Basesis a vector of bases, which can be used to test basis related functions, one basis for each entry in:Coordinates:Covectorsis a vector of covectors, which should be in the cotangent space of the correspondinig point entry in:Points:Coordinatesis a vector of coordinates, which can be used to test coordinate related functions, one coordinate vector for each entry in:Bases:EmbeddedPointsis a vector of points in the embedding space ofM, to testproject:EmbeddedVectorsis a vector of tangent vectors in the embedding space ofM, to testproject:Functionsis a vector of all defined functions forMnote a test is activated by the function (likeexp), adding the mutating function (likeexp!) overwrites the global default (see:Mutating) to true.:GeodesicMaxTimeis a real number indicating the time parameter to use when testinggeodesic:GeodesicSamplesis an integer indicating the number of samples to use when testinggeodesic(defaults to 10):InvalidPointsis a vector of points that are not onM, e.g. to testis_point:InvalidVectorsis a vector of tangent vectors that are not in the tangent space of the first point from:Points:InverseRetractionMethodsis a vector of inverse retraction methods to test onMthese should have the same order as:RetractionMethods(usemissingfor skipping one):Mutatingis a boolean (trueby 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:Nameis a name of the test. If not provided, defaults to"$M":NormalVectorsis a vector of normal vectors, where each should be in the normal space of the corresponding point entries in:Points:Pointsis a vector of at least 2 points onM, which should not be the same point:RetractionMethodsis a vector of retraction methods to test onMthese should have the same order as:InverseRetractionMethods(usemissingfor skipping one):Rngis a random number generator to use for generating random points/vectors if needed:Seedis a seed to use for generating random points/vectors if needed:Vectorsis a vector of at least 2 tangent vectors, which should be in the tangent space of the correspondinig point entries in:Points:VectorTransportMethodsis a vector of vector transport methods to test onM:TestMidpointSymmetryis a boolean (trueby default) whether to test the symmetry property of the midpoint function:TestInfois a boolean (trueby default) whether to test that whethererror=:infoin verification functions issues info messages.:TestWarnis a boolean (trueby default) whether to test that whethererror=:warnin verification functions issues warning.
Possible entries of the expectations dictionary are
- any function tested to provide their expected resulting value, e.g.
exp => pfor the result ofexp(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, andproject, the key is a tuple of the function and:Pointor: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_coordinatesthe key is a tuple of the function and the basis, e.g.(get_coordinates, B) => c - for
get_vectorthe key is a tuple of the function, the coordinate vector, and the basis, e.g.(get_vector, c, B) => X - for
get_vectorsthe key is a tuple of the function and the basis, e.g.(get_vectors, B) => :Symbolwhere:Orthogonaltests for orthogonality:Orthonormaltests additionally to the previous for unit length
get_basison any provided basis, if that function is available. - for
is_default_metric, the value is the default metric :atol => 0.0a global absolute tolerance:atols -> Dict()a dictionaryfunction -> atolfor tolerances of specific function tested.:Types-> Dict() a dictionaryfunction -> Typefor specifying expected types of results of specific functions, for examplemanifold_dimension => Int.:IsPointErrorsis a vector of expected error types for each invalid point provided in:InvalidPoints, usemissingto skip testing for errors for a specific point.:IsVectorErrorsis a vector of expected error types for each invalid vector provided in:InvalidVectors, usemissingto skip testing for errors for a specific vector.:IsVectorBasepointErroris an expected error type when the base point is invalid e.g. foris_vector
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
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.
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
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
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
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
ptopis 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
logandnormare available) (only performed if eitherinjectivity_radiusis not available or the points are within)
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)
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_embeddingis available andXis notmissing) - that the result matches
expected_pointandexpected_vector, respectively, if given - that the projection inverts the embedding (if
projectis available) - that the mutating version
embed!produces the same result(s) (if activated andget_embeddingis available) - that
embed!works on aliased input (p=qorX=Y) (if activated and p/q or X/Y are of same type)
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_pointandexpected_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=qorX=Y) (if activated and p/q or X/Y are of same type)
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
sharpis the inverse - that mutating version
flat!matches non-mutating version (if activated)
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
pis given, that the result is larger or equal to the global injectivity radius
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
Xwith itself is non negative - that the inner product of
Xwith itself is the same as its norm squared (if activated)
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
pon 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)
Manifolds.Test.test_is_default_metric β Function
Manifolds.Test.test_is_default_metric(M, metric::AbstractMetric;
name = "is_default_metric on $M",
)Test the is_default_metric on manifold M.
- that it returns true for the given
metric - that it returns false for all other provided metrics
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.
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
pit returnstrue. - that for each
qinqsit- returns
false - issues a warning (if activated)
- isues an info message (if activated)
- throws the corresponding error from
error_types(if notmissing)
- returns
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
Xit returnstrue. - that for each
YinYsit- returns
false - issues a warning (if activated)
- isues an info message (if activated)
- throws the corresponding error from
error_types(if notmissing)
- returns
- if
check_basepointistrue, then it checks that- for
pthis still returnstrue - for the base point
qit- returns
false - issues a warning (if activated)
- isues an info message (if activated)
- throws the corresponding error from
error_basepoint(if activated)
- returns
- for
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
0the geodesic returnsp - that the function
Ξ³ = geodesic(M, p, X)is consistent with evaluation at0andt` - 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
Nsamples and each of the segments is of length equal to the average speed, i.e.t*norm(M, p, X) / (N-1)
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 toCachedBasis. - that the result matches
expected_value, if given
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_vectorinvertsget_coordinates(if activated)
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
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
pon 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_coordinatesinvertsget_vector(if activated)
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
pon the manifold - that the vectors are orthogonal (if activated)
- that the vectors are normal (if activated)
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)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,Intby default) - that it matches the expected value (if provided)
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)
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
pandqto the mid-point is half the distance fromptoq(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=porr=q) (if activated for mutating)
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
Xwith itself is non negative - that the inner product of
Xwith itself is the same as its norm squared (if activated)
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
qon the manifold - that the result matches
expected_value, if given - that the mutating version
parallel_transport!matches the non-mutating version - that
parallel_transport_toworks 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_directionworks on aliased in put (Y=XorY=d) (if activated for mutating) - that both functions are consistent
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_pointandexpected_vector, respectively, if given - that the mutating version
project!produces the same result(s) (if activated) - that
project!works on aliased input (p=qorX=Y) (if activated and p/q or X/Y are of same type)
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 atpon the manifold (ifvector_atis given) - that the mutating versions
rand!match the non-mutating versions (if activated) - that the four mentioned functions also work with a seed upfront.
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).
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)
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)
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
pis less than or equal to the sectional curvature - that the maximum sectional curvature at
pis greater than or equal to the sectional curvature - that the minimum and maximum sectional curvatures match
expected_minandexpected_max, if given
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
pon the manifold - that the result matches
expected_value, if given - that
flatis the inverse - that mutating version
sharp!matches non-mutating version (if activated)
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
0the geodesic returnsp, at time 2 it returnsq - that the function
Ξ³ = shortest_geodesic(M, p, X)is consistent with evaluation at0,1andt` - that the result at
tis a valid point on the manifold - that the geodesic has constant speed (if activated) using
Nsamples 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
ptoq(if activated)
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
qon the manifold - that the result matches
expected_value, if given - that the mutating version
vector_transport!matches the non-mutating version - that
vector_transport_toworks 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_directionworks on aliased in put (Y=XorY=d) (if activated for mutating) - that both functions are consistent
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)
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
pon 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)
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)
Internals to handle expectations
Manifolds.Test.AbstractExpectation β Type
AbstractExpectationAn abstract type for expectations in tests.
Manifolds.Test.Expect β Type
Expect{T} <: AbstractExpectationA struct to hold expected values for tests of type T.
Fields
value::Tthe expected value
Constructor
Expect(value::T)Manifolds.Test.NoExpectation β Type
NoExcpectation <: AbstractExpectationA struct to indicate that no expectation is provided for a test.
Manifolds.Test.expect β Function
expect(e::Union{Expect{T}, NoExpectation}) where TGet the expected value if provided, error otherwise.
Manifolds.Test.isexpected β Function
expected(e::Union{Expect, NoExpectation})Check if an expectation is provided.
Former tests
Manifolds.find_eps β Function
Manifolds.find_eps(x...)Find an appropriate tolerance for given points or tangent vectors, or their types.
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).
Arguments
basis_has_specialized_diagonalizing_get = false: if true, assumes thatDiagonalizingOrthonormalBasisgiven inbasis_typeshasget_coordinatesandget_vectorthat work without caching.basis_types_to_from = (): basis types that will be tested based onget_coordinatesandget_vector.basis_types_vecs = (): basis types that will be tested based onget_vectorsdefault_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 theexp_log_atol_multiplieris nonzero.expected_dimension_type = Integer: expected type of value returned bymanifold_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 ofis_pointchecks.is_tangent_atol_multiplier = 0: determines atol ofis_vectorchecks.has_get_embedding = false: whether the manifold has a specializedget_embedding(M, p)method (to test mutatingembed!). This is experimental.mid_point12 = test_exp_log ? shortest_geodesic(M, pts[1], pts[2], 0.5) : nothing: if notnothing, then check thatmid_point(M, pts[1], pts[2])is approximately equal tomid_point12. This is by default set tonothingiftext_exp_logis 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 theexp_log_atol_multiplieris 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 thatexpis the inverse oflog.test_injectivity_radius = true: whether implementation ofinjectivity_radiusshould be tested.test_inplace = false: if true check if inplace variants work if they are activated, e.g. check thatexp!(M, p, p, X)work iftest_exp_log = true. This in general requiresis_mutatingto be true.test_is_tangent: if true check that thedefault_inverse_retraction_methodactually 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 thetovariant of vector transportvector_transport_direction = [ true for _ in 1:length(vector_transport_methods)]: whether to check thedirectionvariant of vector transport
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