Alice Le Brigant
email: alice.lebrigant@math.u-bordeaux.fr

A discrete framework to find the optimal matching between manifold-valued curves

Keywords: Shape analysis, optimal matching, manifold-valued curves, discretization

The aim of this paper is to find an optimal matching between manifold-valued curves, and thereby adequately compare their shapes, seen as equivalent classes with respect to the action of reparameterization. Using a canonical decomposition of a path in a principal bundle, we introduce a simple algorithm that finds an optimal matching between two curves by computing the geodesic of the infinite-dimensional manifold of curves that is at all time horizontal to the fibers of the shape bundle. We focus on the elastic metric studied in [10] using the so-called square root velocity framework. The quotient structure of the shape bundle is examined, and in particular horizontality with respect to the fibers. These results are more generally given for any elastic metric. We then introduce a comprehensive discrete framework which correctly approximates the smooth setting when the base manifold has constant sectional curvature. It is itself a Riemannian structure on the product manifold M n of "discrete curves" given by n points, and we show its convergence to the continuous model as the size n of the discretization goes to ∞. Illustrations of optimal matching between discrete curves are given in the hyperbolic plane, the plane and the sphere, for synthetic and real data, and comparison with dynamic programming [16] is established.

Introduction

Context

The study of curves and their shapes is a research area with numerous and varied applications, which is why it has known a great deal of activity over the past years. These curves can be closed or open, and take their values in a Euclidean space or more generally in a Riemannian manifold. To name a few examples, closed plane curves are central in shape analysis of objects [START_REF] Younes | Spaces and manifolds of shapes in computer vision: an overview[END_REF]; the study of trajectories on the Earth requires to deal with open curves on the sphere [START_REF] Zhang | Phase-amplitude separation and modeling of spherical trajectories[END_REF]; and in signal processing, locally stationary Gaussian processes can be represented by open curves in the hyperbolic plane, seen as the statistical manifold of Gaussian densities [START_REF] Brigant | Geometric barycenters of time/Doppler spectra for the recognition of non-stationary targets[END_REF], [START_REF] Brigant | Computing distances and geodesics between manifold-valued curves in the SRV framework[END_REF].

Here we are concerned with the study of open curves in a manifold M of constant sectional curvature.

There are naturally many ways to go about comparing curves in a manifold. One way is to see the space of manifold-valued curves as an (infinite-dimensional) manifold M itself, and equip it with a Riemannian metric G. Then the geodesic between two curves in M describes how one optimally deforms into the other, while its length gives a measure of dissimilarity : the geodesic distance. The advantage of this strategy is that it provides all the convenient tools of the Riemannian framework. An interesting property for the metric G, from the point of view of the applications, is invariance with respect to re-parameterization: for closed curves, this amounts to considering only the shape of an object; for an open curve representing the evolution in time of a given process, this allows us to analyze it regardless of speed or pace. A popular strategy is to consider the quotient space S of curves modulo reparameterization, where two curves are considered identical if they pass through the same points of M but at different speeds, or equivalently when one can be obtained by reparameterizing the other. This quotient space is often called the shape space. If the Riemannian metric G defines the same scalar product at all points of M which project on the same "shape", then G induces a Riemannian structure on the quotient space. Computing geodesics between two shapes for that metric can be done in two steps : (1) establishing an "optimal matching" through the choice of two parameterizations, one for each shape, that will put in correspondence the points on the first shape with points on the second shape, as in Figure 1, and (2) computing the geodesic between the two parameterized curves obtained. Both steps depend on the choice of the metric.

Previous work

Since the simplest metric one can think of, the L 2metric (slightly modified to stay constant along the fibers), induces a vanishing distance on the quotient space [START_REF] Michor | Vanishing geodesic distance on spaces of submanifolds and diffeomorphisms[END_REF], different classes of metrics have been studied to perform shape analysis. The large class of Sobolev metrics involves higher order derivatives to overcome the vanishing problem of the L 2 -metric [START_REF] Michor | An overview of the Riemannian metrics on spaces of curves using the Hamiltonian approach[END_REF]. A firstorder Sobolev metric for plane curves was introduced in [START_REF] Younes | Computable elastic distances between shapes[END_REF] and used in [START_REF] Younes | A Metric on shape space with explicit geodesics[END_REF], which can be mapped to the L 2 -metric by a change of coordinates, namely by considering the complex square root of the speed of the curve. This metric was modified by the authors of [START_REF] Mio | On shape of plane elastic curves[END_REF] to define the family of elastic metrics G a,b , parameterized by two constants a and b which control the degree of bending and stretching of the curve. In [START_REF] Srivastava | Shape analysis of elastic curves in Euclidean spaces[END_REF], the authors show that for a certain choice of parameters, the elastic metric can again be mapped to the L 2 -metric using the so-called square root velocity (SRV) coordinates, where a curve is represented by its speed renormalized by the square root of its norm. The SRV framework was generalized in [START_REF] Bauer | Constructing reparametrization invariant metrics on spaces of plane curves[END_REF] for any elastic metric with weights a and b satisfying a certain relation. A quotient structure for the metric used in [START_REF] Srivastava | Shape analysis of elastic curves in Euclidean spaces[END_REF] is carefully developed in [START_REF] Lahiri | Precise matching of PL curves in R n in the square root velocity framework[END_REF], where the authors prove that if at least one of two curves is piecewise-linear, then there exists a minimizing geodesic between the two, and give a precise algorithm to solve the matching problem. In [START_REF] Bruveris | Optimal reparametrizations in the square root velocity framework[END_REF], it is proven that in the same framework, there always exists an optimal reparameterization realizing the minimal distance between two C 1 plane curves. Another approach is proposed in [START_REF] Tumpach | Quotient elastic metrics on the manifold of arc-length parameterized plane loops[END_REF], where the authors restrict to arc-length parameterized curves and characterize the horizontal space of the quotient structure for these curves in the elastic framework.

Concerning manifold-valued curves, the geodesic equations for Sobolev metrics in the space of curves and in the shape space were given in [START_REF] Bauer | Sobolev metrics on shape space of surfaces[END_REF] in terms of the gradient of the metric with respect to itself. A generalization of the SRV framework to manifold-valued curves was introduced in [START_REF] Zhang | Video-based action recognition using rate-invariant analysis of covariance trajectories[END_REF] and used in [START_REF] Zhang | Phase-amplitude separation and modeling of spherical trajectories[END_REF], while another one was proposed in [START_REF] Brigant | Computing distances and geodesics between manifold-valued curves in the SRV framework[END_REF]. Extension to curves in a Lie group or a homogeneous space can also be found in [START_REF] Celledoni | Shape analysis on Lie groups with applications in computer animation[END_REF], [START_REF] Celledoni | Shape analysis on homogeneous spaces[END_REF], [START_REF] Su | Comparing Curves in Homogeneous Spaces[END_REF]. Both metrics in [START_REF] Zhang | Video-based action recognition using rate-invariant analysis of covariance trajectories[END_REF] and [START_REF] Brigant | Computing distances and geodesics between manifold-valued curves in the SRV framework[END_REF] coincide with the metric of [START_REF] Srivastava | Shape analysis of elastic curves in Euclidean spaces[END_REF] in the flat case, however they define different Riemannian structures when the base space has curvature. The difference lies in the way computations are made -in [START_REF] Zhang | Video-based action recognition using rate-invariant analysis of covariance trajectories[END_REF] and [START_REF] Zhang | Phase-amplitude separation and modeling of spherical trajectories[END_REF] they are moved to the tangent spaces at the origins of the curves, resulting in simpler computations, whereas in [START_REF] Brigant | Computing distances and geodesics between manifold-valued curves in the SRV framework[END_REF] they are done directly in the base manifold M , transporting data pointwise across M from one curve to the other, thus making the comparison more sensitive to the local "geography" of M . When comparing the geodesic distances, this difference is measured by a curvature term (see [START_REF] Brigant | Computing distances and geodesics between manifold-valued curves in the SRV framework[END_REF], Prop. 3). In addition, unlike the metric of [START_REF] Zhang | Video-based action recognition using rate-invariant analysis of covariance trajectories[END_REF], the one in [START_REF] Brigant | Computing distances and geodesics between manifold-valued curves in the SRV framework[END_REF] can be written as an elastic metric (with a = 2b = 1). The work of [START_REF] Zhang | Video-based action recognition using rate-invariant analysis of covariance trajectories[END_REF] is applied to curves in the space of symmetric positive definite matrices, while the case of spherical trajectories is investigated in [START_REF] Zhang | Phase-amplitude separation and modeling of spherical trajectories[END_REF], where the authors exhibit simplifications. In both cases, optimal matching between curves is achieved through dynamic programming. On the other hand, the Riemannian structure in [START_REF] Brigant | Computing distances and geodesics between manifold-valued curves in the SRV framework[END_REF] is applied to curves in the hyperbolic plane, but the question of optimal matching is not studied. This is remedied here.

Contributions of this paper

The aim of this paper is three-fold : (1) study the quotient structure associated to the Riemannian metric G of [START_REF] Brigant | Computing distances and geodesics between manifold-valued curves in the SRV framework[END_REF], and more generally to any elastic metric on manifold-valued curves, [START_REF] Bauer | Constructing reparametrization invariant metrics on spaces of plane curves[END_REF] exploit this knowledge of horizontality in an algorithm that computes an optimal matching between shapes -and whose range of application goes beyond elastic metrics -and (3) give a comprehensive discrete Riemannian framework on the finite-dimensional manifold of "discrete curves" that correctly approximates these procedures for the particular case of the SRV framework and constant sectional curvature. More specifically,

• we characterize the horizontal subspace associated to the quotient shape space, for any elastic metric and in particular for the SRV metric G. Namely, we decompose any infinitesimal deformation of a smooth curve into a vertical part, which reparameterizes the curve without changing its shape, and a G-orthogonal horizontal part. This is done in a similar way as in [START_REF] Tumpach | Quotient elastic metrics on the manifold of arc-length parameterized plane loops[END_REF] but without restriction to arclength parameterized curves. • We write any path in the space of smooth curves as a horizontal path composed with a path of reparameterizations. We use this decomposition to define an algorithm that, for a fixed parameterization of one of two curves, approximates the horizontal geodesic linking it to the fiber of the other curve, thereby yielding the "closest parameterization" of the latter with respect to the fixed parameterization of the former. We refer to this correspondence as an optimal matching. This algorithm can be used for any metric structure as long as one knows how to compute geodesics and characterize horizontality. Comparison with the popular dynamic programming approach [START_REF] Srivastava | Functional and Shape Data Analysis[END_REF] is established in the simulations section. • We define a discrete version of G that is a Riemannian metric on the finite-dimensional manifold M n+1 of "discrete curves" given by n + 1 points, when M has constant sectional curvature K ∈ {-1, 0, 1}. We show that the energy of a path of discrete curves converges to the energy of the limit path as the size n of the discretization goes to ∞. We give the geodesic equations for this metric, characterize the Jacobi fields, describe geodesic shooting, and show simulations on synthetic and real data in R 2 , R 3 , the hyperbolic plane and the sphere.

Outline

After reminding the continuous model previously introduced in [START_REF] Brigant | Computing distances and geodesics between manifold-valued curves in the SRV framework[END_REF], Section 2 describes the horizontal space of the quotient structure and a way to compute horizontal geodesics. In Section 3, we introduce the discretization, and give the convergence result toward the continuous model, which is later proved in Section 5.

Section 4 shows results of simulations in the three settings of positive, zero and negative curvature. M a vector field along c, we denote by c t := dc/dt = c the derivative of c with respect to t and by ∇ t w := ∇ ct w, ∇ 2 t w := ∇ ct ∇ ct w the first and second order covariant derivatives of w along c. Parallel transport of a tangent vector u ∈ T c(t1) M from c(t 1 ) to c(t 2 ) along c is denoted by P t1,t2 c (u), or when there is no ambiguity on the choice of the curve c, u t1,t2 , or even u to lighten notations in some cases. We associate to each curve c its renormalized speed vector field v := c /|c |, and to each vector field t → w(t) along c, its tangential and normal components w T := w, v v and w N := w -w T . Finally, for all x ∈ M we denote by exp x : T x M → M the exponential map on M and by log x : M → T x M its inverse map.

The space of smooth parameterized curves

The Riemannian structure

We represent open oriented curves in M by smooth immersions, i.e. smooth curves with velocity that doesn't vanish. The set M of smooth immersions in M is an open submanifold of the Fréchet manifold C ∞ ([0, 1], M ) [START_REF] Michor | Manifolds of mappings and shapes, in the book The legacy of Bernhard Riemann after one hundred and fifty years[END_REF] and its tangent space at a point c is the set of infinitesimal deformations of c, which can be seen as vector fields along the curve c in M

M = {c ∈ C ∞ ([0, 1], M )|c (t) = 0, ∀t ∈ [0, 1]}, T c M = {w ∈ C ∞ ([0, 1], T M )|w(t) ∈ T c(t) M, ∀t ∈ [0, 1]}.
Reparametrizations are represented by increasing diffeomorphisms ϕ : [0, 1] → [0, 1] (so that they preserve the end points of the curves), and their set is denoted by Diff + ([0, 1]). We adopt the so-called square root velocity (SRV) representation, i.e. we represent each curve c ∈ M by the pair formed by its starting point x and its speed vector field renormalized by the square root of its norm, via the bijection

M → M × T M c → x := c(0), q := c |c | .
The inverse of this function is simply given by M × T M (x, q) → π M (q) ∈ M, if π M is the canonical projection T M → M. The renormalization of the speed vector field in q allows us to define a reparameterization invariant metric, as we will see shortly. For any tangent vector w ∈ T c M, consider a path of curves s → c w (s) ∈ M such that c w (0) = c and c w s (0) := ∂c w /∂s(0) = w. We denote by q w := c w t /|c w t | 1/2 the square root velocity representation of c w . With these notations, we equip M with a Riemannian metric G, defined by

G c (w, w) = |w(0)| 2 + 1 0 |∇ s q w (0, t)| 2 dt. (1)
This definition does not depend on the choice of c w and we can reformulate this scalar product in terms of (covariant) derivatives of w. Indeed, note that

∇ s q w (0, t) = ∇ c w s (0,t) (c w t /|c w t | 1 2 ) = |c w t (0, t)| -1 2 (∇ c w s (0,t) c w t -1/2(∇ c w s (0,t) c w t ) T
), which gives after inverting the derivatives according to s and t,

∇ s q w (0, t) = |c | -1 (∇ t w N + 1 2 ∇ t w T
). The scalar product can then be rewritten

G c (w, w) = |w(0)| 2 + 1 0 |∇ t w N | 2 + 1 4 |∇ t w T | 2 dt |c | , G c (w, w) = |w(0)| 2 + |∇ w N | 2 + 1 4 |∇ w T | 2 d , (2)
where d = |c (t)|dt and ∇ = 1 |c (t)| ∇ t respectively denote integration and covariant derivation according to arc length. This metric belongs to the class of socalled elastic metrics parameterized by any a, b ∈ R, which can be defined for manifold-valued curves as

G a,b c (w, w) = |w(0)| 2 + a 2 |∇ w N | 2 + b 2 |∇ w T | 2 d . With formulation (2) it is clear that G = G 1, 1
2 is invariant under the action of reparameterizing the curve and its tangent vectors by any increasing diffeomorphism

ϕ ∈ Diff + ([0, 1]), G c•ϕ (w • ϕ, z • ϕ) = G c (w, z), ∀w, z ∈ T c M. (3)
This reparameterization invariance property will allow us to induce a Riemmannian structure on the quotient space as we will see in Section 2.3.

Geodesics between parameterized curves

Two curves c 0 , c 1 ∈ M can be compared using the geodesic distance induced by G, i.e. by computing the length of the shortest path of curves

[0, 1] s → c(s) ∈ M from c 0 to c 1 d G (c 0 , c 1 ) = inf {L(c) : c(0) = c 0 , c(1) = c 1 } , (4)
where the length of a path c can be written in terms of its SRV representation

(x, q) : [0, 1] → M × T M s → x(s) := c(s, 0), q(s, •) := c t (s, •) |c t (s, •)| 1/2 , (5)
as

L(c) = 1 0 |x s (s)| 2 + 1 0 |∇ s q(s, t)| 2 dt ds.
Note that here -and in all that follows -we indifferently use the notations c(s, t) = c(s)(t), q(s, t) = q(s)(t) for all s, t ∈ [0, 1]. Now we recall a result shown in [START_REF] Brigant | Computing distances and geodesics between manifold-valued curves in the SRV framework[END_REF], which characterizes the geodesic paths of M, i.e. those which achieve the infimum in (4), by searching for the critical points of the energy functional

E : M → R + , E(c) = 1 0 |x (s)| 2 + 1 0 |∇ s q(s, t)| 2 dt ds. (6)
Proposition 1 (Geodesic equations) A geodesic path [0, 1] s → c(s) ∈ M for G, or more specifically its SRV representative s → (x(s), q(s)) (5), verifies the equations

∇ s x s (s) + r(s, 0) =0, ∇ 2 s q(s, t) + |q(s, t)| r(s, t) + r(s, t) T =0, (7)
for all s, t ∈ [0, 1], where the curvature term r(s, t) integrates the vector field R(q, ∇ s q)c s parallel transported back to t along c(s, •),

r(s, t) = 1 t R(q, ∇ s q)c s (s, τ ) τ,t dτ, t ∈ [0, 1].
Remark 1 In the flat case M = R d , the curvature term r vanishes and we obtain ∇ s x s (s) = 0, ∇ 2 s q(s, t) = 0 for all s and t. This means that the geodesic between two curves (x 0 , q 0 ) and (x 1 , q 1 ) in the SRV coordinates is composed of a straight line s → x(s) and an L 2 -geodesic s → q(s, •). In other words, the geodesic links the starting points with a straight line and linearly interpolates between the renormalized speeds. Notice that if this linear interpolation goes through zero, the geodesic does not exist in Imm([0, 1], M ). This can be avoided by considering a larger space of curves, such as the set of absolutely continuous curves [START_REF] Lahiri | Precise matching of PL curves in R n in the square root velocity framework[END_REF]. A possibility to construct the geodesics of M is to use geodesic shooting. By solving the geodesic equations [START_REF] Jost | Riemannian geometry and geometric analysis[END_REF] we can construct the geodesic path starting from a given curve c 0 at a given speed w ∈ T c0 M -this is the exponential map on M. Given two curves c 0 , c 1 , geodesic shooting allows us to iteratively find the appropriate initial speed w which will make the geodesic land on c 1 . The idea is to "shoot" from c 0 in a certain direction using the exponential map, estimate the gap between the end point of the obtained geodesic and the target point c 1 , "bring back" this information at c 0 using a Jacobi field and finally use this information to correct the shooting direction.

Jacobi fields are vector fields that describe the way that geodesics spread out in the Riemannian manifold: for any geodesic s → c(s) in M and Jacobi field s → J(s) along c, there exists a family of geodesics (-δ, δ) a → c(a, •) such that for all s, c(0, s) = c(s) and

J(s) = ∂ ∂a a=0 c(a, s).
At a given step of the geodesic shooting algorithm, we consider the Jacobi field that measures the difference between the geodesic obtained by shooting and the desired geodesic between c 0 and c 1 : it has initial value J(0) = 0 since both have same starting point c 0 , and its end value can be estimated by J(1) = log L2 c0 c 1 , where log L2 c denotes the inverse of the exponential map for the L 2 -metric on M, simply given by log L2 c0 (c 1 )(t) = log c0(t) (c 1 (t)) for t ∈ [0, 1]. The shooting direction can then be corrected by the derivative ∇ s J(0) of the Jacobi field at the origin, as shown in Figure 2. For more details, we refer the reader to [START_REF] Brigant | Computing distances and geodesics between manifold-valued curves in the SRV framework[END_REF].

Algorithm 1 (Geodesic shooting) Input: c 0 , c 1 ∈ M. Initialization: w = log L2 c0 (c 1 ). Repeat until convergence :

1. compute the geodesic s → c(s) starting from c 0 at speed w by solving the geodesic equations (7), 2. evaluate the difference j := log L 2 c(1) (c 1 ) between the target curve c 1 and the extremity c(1) of the obtained geodesic, 3. compute the initial derivative ∇ s J(0) of the Jacobi field s → J(s) along the path of curves c verifying J(0) = 0 and J(1) = j, 4. correct the shooting direction w = w + ∇ s J(0). Output: geodesic c. This algorithm requires the characterization of the Jacobi fields for G on M, and a way to deduce the initial derivative ∇ s J(0) of a Jacobi field from its initial and final values J(0), J [START_REF] Bauer | Sobolev metrics on shape space of surfaces[END_REF]. Concerning these two points, we refer the reader to [START_REF] Brigant | Computing distances and geodesics between manifold-valued curves in the SRV framework[END_REF] : the Jacobi fields of M are shown to be solutions of a linear PDE, which can be solved to obtain the final value J(1) of a Jacobi field J along a path of curves c knowing its initial conditions J(0) and ∇ s J(0). If we consider only Jacobi fields with initial value J(0) = 0, then the function ϕ : T c(0) M → T c(1) M, ∇ s J(0) → J( 1) is a linear bijection between two vector spaces and its inverse map can be computed by considering the image of a basis of T c(0) M. The equations characterizing the Jacobi fields in the discrete setting will be given in Section 3.

The space of unparameterized curves

The quotient structure

In order to compare curves regardless of parameterization, we consider the quotient S = M/Diff + ([0, 1]) of the space of curves by the diffeomorphisms group. This quotient is not a manifold, as it has singularities, i.e. points with non trivial isotropy group [START_REF] Michor | Manifolds of mappings and shapes, in the book The legacy of Bernhard Riemann after one hundred and fifty years[END_REF]. That is why from now on we assume that M denotes the set of free immersions, i.e. immersions on which the diffeomorphism group acts freely. That way, the space of curves M and the quotient shape space S are respectively the total and base spaces of a principal bundle, the fibers of which are the sets of all the curves that are identical modulo reparameterization, i.e. that project on the same "shape". We denote by π : M → S the projection of the fiber bundle and by c := π(c) ∈ S the shape of a curve c ∈ M. The tangent bundle can then be decomposed T M = Ver ⊕ Hor into a vertical subspace consisting of all vectors tangent to the fibers of M over S, that is, those which have an action of reparameterizing the curve without changing its shape and a horizontal subspace defined as the orthogonal of the vertical subspace according to G

Ver c = ker T c π = {mv, m ∈ C}, C = {m ∈ C ∞ ([0, 1], R), m(0) = m(1) = 0},
Hor c = (Ver c ) ⊥ G = {h ∈ T c M f : G c (h, mv) = 0 ∀m ∈ C}.
If G is constant along the fibers, i.e. verifies property (3), then there exists a Riemannian metric Ḡ on the shape space S such that π is a Riemannian submersion from (M, G) to (S, Ḡ),

G c (w hor , z hor ) = Ḡπ(c) (T c π(w), T c π(z)) ,
where w hor and z hor are the horizontal parts of tangent vectors w and z, as well as the horizontal lifts of T c π(w) and T c π(z), respectively. This expression defines Ḡ in the sense that it does not depend on the choice of the representatives c, w and z ([13], §29.21).

If a geodesic for G has a horizontal initial speed, then its speed vector stays horizontal at all times -we say it is a horizontal geodesic -and projects on a geodesic of the shape space for Ḡ ([13], §26.12). To compute the distance between two shapes c 0 and c 1 in the quotient space we choose a representative c 0 of c 0 and compute the distance (in M) to the closest representative of c 1 , as shown schematically in Figure 3,

d (c 0 , c 1 ) = inf d (c 0 , c 1 • ϕ) | ϕ ∈ Diff + ([0, 1]) .
By definition, the distance in the quotient space allows us to compare curves regardless of parameterization

d c 0 • ϕ, c 1 • ψ = d (c 0 , c 1 ) , ∀ϕ, ψ ∈ Diff + ([0, 1]).
We now characterize the horizontal subspace for any elastic metric G a,b and in particular for our metric G 1, 1 2 , and give the decomposition of a tangent vector.

Proposition 2 (Horizontal part of a vector) Let c ∈ M be a smooth immersion. Then h ∈ T c M is horizontal for the elastic metric G a,b if and only if

(a/b) 2 -1 ∇ t h, ∇ t v -∇ 2 t h, v + |c | -1 ∇ t c , v ∇ t h, v = 0.
In particular, for a = 2b = 1 we obtain

Hor c = {h ∈ T c M : ∀t ∈ [0, 1], 3 ∇ t h, ∇ t v -∇ 2 t h, v + |c | -1 ∇ t c , v ∇ t h, v = 0}.
Any tangent vector w ∈ T c M can be decomposed in horizontal and vertical components w = w hor + w ver given by w ver = mv, w hor = w -mv, where the real function m ∈ C verifies the ordinary differential equation

m -∇ t c /|c |, v m -4|∇ t v| 2 m = ∇ 2 t w, v -3 ∇ t w, ∇ t v -∇ t c /|c |, v ∇ t w, v . (8)
Proof Let h ∈ T c M be a tangent vector. It is horizontal if and only if it is orthogonal to any vertical vector, that is any vector of the form mv with m ∈ C ∞ ([0, 1], R) such that m(0) = m(1) = 0. We have ∇ t (mv) = m v + m∇ t v and since ∇ t v, v = 0 we get ∇ t (mv) N = m∇ t v and ∇ t (mv) T = m v. The scalar product can then be written

G a,b c (h, mv) = h(0), m(0)v(0) + 1 0 (a 2 ∇ t h N , ∇ t (mv) N + b 2 ∇ t h T , ∇ t (mv) T ) dt |c | = 1 0 (a 2 m ∇ t h, ∇ t v + b 2 m ∇ t h, v ) dt |c | = 1 0 a 2 m ∇ t h, ∇ t v dt |c | - 1 0 b 2 m d dt ∇ t h, v |c | -1 dt = 1 0 m/|c | (a 2 -b 2 ) ∇ t h, ∇ t v -b 2 ∇ 2 t h, v + b 2 ∇ t c , v ∇ t h, v |c | -1 dt,
by integration by parts. The vector h is horizontal if and only if G c (h, mv) = 0 for all such m, and so multiplying by |c |/b 2 gives the desired equation. Now consider a tangent vector w and a real function m : [0, 1] → R such that m(0) = m(1) = 0. Then according to the above, w -mv is horizontal if and only if it verifies

3 ∇ t (w -mv), ∇ t v -∇ 2 t (w -mv), v + |c | -1 ∇ t c , v ∇ t (w -mv), v = 0, i.e., since ∇ t v, v = 0, ∇ 2 t v, v = -|∇ t v| 2 and ∇ 2 t (mv) = m v + 2m ∇ t v + m∇ 2 t v, if 3 ∇ t w, ∇ t v -3|∇ t v| 2 m -∇ 2 t w, v + m -m|∇ t v| 2 + |c | -1 ∇ t c , v ( ∇ t w, v -m ) = 0,
which is what we wanted.

Computing geodesics in the shape space

Recall that the geodesic path s → c(s) between the shapes of two curves c 0 and c 1 is the projection of the horizontal geodesic -if it existss → c h (s) linking c 0 to the fiber of c 1 in M, i.e. such that c h (0

) = c 0 , c h (1) ∈ π -1 (c 1 ) and ∂ s c h (s) ∈ Hor c h (s) for all s ∈ [0, 1], c = π(c h ).
The end point of c h then gives the optimal reparameterization c 1 • ϕ of the target curve c 1 with respect to the initial curve c 0 , i.e. such that

d(c 0 , c 1 ) = d(c 0 , c 1 • ϕ).
The parameterized curves (c 0 , c 1 • ϕ) define what we call an optimal matching between the shapes c 0 and c 1 , in the sense that each point c 0 (t) on c 0 is matched with the point c 1 (ϕ(t)) on c 1 . Here we propose a method to approach the horizontal geodesic c h , and thereby the corresponding optimal matching. To that end we decompose any path of curves s → c(s) in M into a horizontal path composed with a path of reparameterizations, c(s) = c hor (s) • ϕ(s), or equivalently

c(s, t) = c hor (s, ϕ(s, t)) ∀s, t ∈ [0, 1], (9)
where the path [0, 1] s → c hor (s) ∈ M is such that c hor s (s) ∈ Hor c hor (s) for all s ∈ [0, 1], and

[0, 1] s → ϕ(s) ∈ Diff + ([0, 1]
) is a path of increasing diffeomorphisms. The horizontal and vertical parts of the speed vector of c can be expressed in terms of this decomposition. Indeed, by taking the derivative of ( 9) with respect to s and t we obtain

c s (s) = c hor s (s) • ϕ(s) + ϕ s (s) • c hor t (s) • ϕ(s), (10a)
c t (s) = ϕ t (s) • c hor t (s) • ϕ(s), (10b)
and so with v hor (s, t) := c hor t (s, t)/|c hor t (s, t)|, since

ϕ t > 0, (10b) gives v(s) = v hor (s) • ϕ(s).
We can see that the first term on the right-hand side of Equation (10a) is horizontal. Indeed, for any path of real functions m :

[0, 1] → C ∞ ([0, 1], R), s → m(s, •) such that m(s, 0) = m(s, 1) = 0 for all s, since G is reparameterization invariant we have G c hor s (s) • ϕ(s), m(s) • v(s) = G c hor s (s) • ϕ(s), m(s) • v hor (s) • ϕ(s) = G c hor s (s), m(s) • ϕ(s) -1 • v hor (s) = G c hor s (s), m(s) • v hor (s) with m(s) = m(s) • ϕ(s) -1
. Since m(s, 0) = m(s, 1) = 0 for all s, the vector m(s)•v hor (s) is vertical and its scalar product with the horizontal vector c hor s (s) vanishes. On the other hand, the second term on the right hand-side of Equation (10a) is vertical, since it can be written

ϕ s (s) • c hor t • ϕ(s) = m(s) • v(s), with m(s) = |c t (s)|ϕ s (s)/ϕ t (s) verifying m(s, 0) = m(s, 1)
= 0 for all s. Finally, the vertical and horizontal parts of the speed vector c s (s) are given by

c s (s) ver = m(s) • v(s) = |c t (s)|ϕ s (s)/ϕ t (s) • v(s), (11a)
c s (s) hor = c s (s) -m(s) • v(s) = c hor s (s) • ϕ(s). (11b)
Definition 1 We call c hor the horizontal part of the path c with respect to G.

Proposition 3

The horizontal part of a path of curves c is at most the same length as c

L G (c hor ) ≤ L G (c).
Proof Since the metric G is reparameterization invariant, the squared norm of the speed vector of the path c at time s ∈ [0, 1] is given by

c s (s, •) 2 G = c hor s (s, ϕ(s, •)) 2 G + |ϕ s (s, •)| 2 c hor t (s, ϕ(s, •) 2 G = c hor s (s, •) 2 G + |ϕ s (s, •)| 2 c hor t (s, •) 2 G ,
where

• 2 G := G(•, •).
This gives c hor s (s) G ≤ c s (s) for all s and so L G (c hor ) ≤ L G (c). Now we will see how the horizontal part of a path of curves can be computed.

Proposition 4 (Horizontal part of a path) Let s → c(s) be a path in M. Then its horizontal part is given by c hor (s, t) = c(s, ϕ(s) -1 (t)), where the path of diffeomorphisms s → ϕ(s) is solution of the partial differential equation

ϕ s (s, t) = m(s, t)/|c t (s, t)| • ϕ t (s, t), (12)
and where m(s) : [0, 1] → R, t → m(s, t) is solution for all s of the ordinary differential equation

m tt -∇ t c t /|c t |, v m t -4|∇ t v| 2 m = ∇ 2 t c s , v -3 ∇ t c s , ∇ t v -∇ t c t /|c t |, v ∇ t c s , v .
Proof We have seen in Equation (11a) that the vertical part of c s (s) can be written as m(s) • v(s) where m(s) = |c t (s)|ϕ s (s)/ϕ t (s), and as the norm of the vertical part of c s (s), m(s) is solution of the ODE (8) for all s. If we take the horizontal part of the geodesic linking two curves c 0 and c 1 , we will obtain a horizontal path linking c 0 to the fiber of c 1 which will no longer be a geodesic path. However this path reduces the distance between c 0 and the fiber of c 1 , and gives a "better" representative c 1 • ϕ(1) of the target curve. By computing the geodesic between c 0 and this new representative, we are guaranteed to reduce once more the distance to the fiber. The algorithm that we propose simply iterates these two steps, as illustrated in Figure 4.

Algorithm 2 (Optimal matching)

Input: c 0 , c 1 ∈ M. Initialization: n = 0, c n 1 = c 1 . Repeat until convergence: 1. construct the geodesic s → c n (s) between c 0 and c n 1 , 2. compute the horizontal part s → [c n ] hor (s) of c n , 3. set c n+1 1 = [c n ] hor (1), 4. set n = n + 1. Output: horizontal geodesic c n .
Let us specify why the obtained geodesic is horizontal at the limit. The series of lengths (L(c n )) n≥0 and L([c n ] hor ) n≥0 are non negative decreasing and verify at each step n

L(c n ) ≥ L([c n ] hor ) ≥ L(c n+1 ),
which means that they converge to the same limit. The same is true for the energies E(c n ) and E([c n ] hor ), and since the s-derivative of [c n ] hor is equal to the horizontal part of the s-derivative of c n , we get

c n s (s) ver 2 G ds = E(c n ) -E([c n ] hor ) -→ n→∞ 0,
and so c n s (s) ver G converges to zero for almost all s. Since it is enough that a geodesic be horizontal at one given time for it to be horizontal for all time s ([13], §26.12), we have the following result.

Proposition 5 (Horizontality of the solution) At the limit, the geodesic between the fibers computed in Algorithm 2 is horizontal

∀s c n s (s) ver -→ n→∞ 0.
Remark 2 In this work, we will carry out step 1 using geodesic shooting. However it is important to stress that Algorithm 2 is a general method that can be applied to any metric structure (not only elastic metrics) for which one knows how to compute geodesics and characterize the horizontal subspace of the shape bundle. It can be seen as an alternative method to the popular dynamic programming approach [START_REF] Srivastava | Functional and Shape Data Analysis[END_REF], with which we establish comparisons in Section 4. But before that, let us first introduce a formal discretization of the continuous model presented so far.

The discrete model

Applications usually give access to a finite number of observations of a continuous process and provide series of points instead of continuous curves. It is therefore important to discretize the framework presented above and to consider the finite-dimensional space of "discrete curves". From now on we restrict to base manifolds M of constant sectional curvature K. This allows us to get an explicit formula for the Jacobi fields of M (Lemma 1) and thus derive a precise approximation of the smooth Riemannian structure of Section 2. Generalization to any Riemannian manifold for which the Jacobi fields are computable should not be problematic. For more complex manifolds, a faster and more approximate solution would be to directly discretize the smooth equations, at the cost of the precision of the discrete approximation.

The Riemannian structure

We consider the product manifold M n+1 of "discrete curves" given by n + 1 points, for a fixed n ∈ N * . Its tangent space at a given point α = (x 0 , . . . , x n ) is

T α M n+1 = {w = (w 0 , . . . , w n ) : w k ∈ T x k M, ∀k}.
Assuming that there exists a connecting geodesic between x k and x k+1 for all k -which seems reasonable considering that the points x k should be "close" since they correspond to the discretization of a continuous curve -and that two consecutive points are always distinct (x k = x k+1 ), we use the following notations as well as

τ k = log x k x k+1 , q k = √ n τ k / |τ k |, v k = τ k /|τ k |, (13)
w k T = w k , v k v k and w N k = w k -w k T
to refer to the tangential and normal components of a tangent vector

w k ∈ T x k M . Given a tangent vec- tor w ∈ T α M n+1 , we consider a path of piecewise geodesic curves [0, 1] 2 (s, t) → c w (s, t) ∈ M such that c w (0, k n ) = x k for k = 0, . . . , n, c w (s, •) is a geodesic of M on the interval [ k n , k+1
n ] for all s ∈ [0, 1] and k -and in particular c w t (0, k n ) = nτ k -and such that c w s (0, k n ) = w k , as illustrated in Figure 5. Then we define the squared norm of w by

G n α (w, w) = |w 0 | 2 + 1 n n-1 k=0 |∇ s q w (0, k n )| 2 . ( 14
)
This definition is a discrete analog of (1), and just as in the continuous case, it does not depend on the choice of c w . Indeed, we can also obtain a discrete analog of (2).

Proposition 6

The metric G n can also be written

G n α (w, w) = |w 0 | 2 + n-1 k=0 (D τ w) N k 2 + 1 4 (D τ w) T k 2 1 |τ k | ,
where the map

D τ : T α M n+1 → T α M n+1 , w → D τ w = (D τ w) 0 , . . . , (D τ w) n is defined by (D τ w) k := 1 n ∇ t c w s (0, k n ) = (w k+1 -w k ) T + b -1 k (w k+1 -a k w k ) N ,
if w k+1 denotes the parallel transport of w k+1 from x k+1 to x k along the geodesic, and the coefficients a k and b k take the following values depending on the sectional curvature K of the base manifold

M    a k = cosh |τ k |, b k = sinh |τ k |/|τ k |, if K = -1, a k = 1, b k = 1, if K = 0, a k = cos |τ k |, b k = sin |τ k |/|τ k |, if K = +1. ( 15
)
Remark 3 Notice that in the flat case our definition gives (D τ w) k = w k+1 -w k . In the non-flat case, when the discretization gets "thinner", i.e. n → ∞ and

|τ k | → 0 while n|τ k | stays bounded for all 0 ≤ k ≤ n, we get (D τ w) k = n→∞ w k+1 -w k + o(1).
Before we prove this proposition, let us recall a wellknown result about Jacobi fields that will prove useful to derive the equations in the discrete case.

Lemma 1 Let γ : [0, 1] → M be a geodesic of a manifold M of constant sectional curvature K, and J a Jacobi field along γ. Then the parallel transport of J(t) along γ from γ(t) to γ(0) is given by

J(t) t,0 = J T (0) + ãk (t)J N (0) + t ∇ t J T (0) + bk (t)∇ t J N (0), for all t ∈ [0, 1], where      ãk (t) = cosh (|γ (0)|t) , bk (t) = sinh(|γ (0)|t) |γ (0)| , K = -1, ãk (t) = 1, bk (t) = t, K = 0, ãk (t) = cos (|γ (0)|t) , bk (t) = sin(|γ (0)|t) |γ (0)| , K = +1.
Proof (Proof of Lemma 1) For the sake of completeness, the proof is reminded in the appendix.

Proof (Proof of Proposition 6) Let α ∈ M n+1 be a "discrete curve" and w ∈ T α M n+1 a tangent vector at α. Consider a path of piecewise geodesic curves s → c w (s) that verifies all the conditions given above to define G n (w, w), and set (D τ w) k := 1 n ∇ t c w s (0, k n ). Then by definition, the vector field J k (u) = c w s (s, k+u n ), u ∈ [0, 1] is a Jacobi field along the geodesic linking

x k to x k+1 , verifying J k (0) = w k , J k (1) = w k+1 and ∇ u J k (0) = (D τ w) k . Applying Lemma 1 gives w k+1 = w k T + a k w k N + (D τ w) k T + b k (D τ w) k N .
This gives (w k+1

) T = w k T +(D τ w) k T and (w k+1 ) N = a k w k N + b k (D τ w) k N and so (D τ w) k = (D τ w) k T + (D τ w) k N = (w k+1 -w k ) T + b -1 k (w k+1 -a k w k ) N .
Finally, we observe that the covariant derivative involved in the definition of G n can be written

∇ s q w (0, k n ) = |c w t (0, k n )| -1 2 (∇ s c w t (0, k n ) -1 2 ∇ s c w t (0, k n ) T ) = |nτ k | -1 2 n(D τ w) k -1 2 n(D τ w) k T ), i.e. ∇ s q w (0, k n ) = (n/|τ k |) 1/2 (D τ w) k N + 1 2 (D τ w) k T .
Injecting this into [START_REF] Michor | Manifolds of mappings and shapes, in the book The legacy of Bernhard Riemann after one hundred and fifty years[END_REF] gives the desired formula. Now we present the main result of this section, that is, the convergence of the discrete model toward the continuous model.

Definition 2 Let α = (x 0 , . . . , x n ) ∈ M n+1 be a discrete curve, and t → c(t) ∈ M a smooth curve. We say that α is the discretization of size n of c when c( k n ) = x k for all k = 0, . . . , n. If s → α(s) = (x 0 (s), . . . , x n (s)) ∈ M n+1 is a path of discrete curves and s → c(s) ∈ M a path of smooth curves, then α is the discretization of size n of c when α(s) is the discretization of c(s) for all s ∈ [0, 1], i.e. when x k (s) = c(s, k n ) for all s and k. We will still use this term if c is not smooth, and speak of the only path of piecewise-geodesic curves of which α is the discretization.

Let [0, 1] s → α(s) = (x 0 (s), . . . , x n (s)) ∈ M n+1 be a path of discrete curves. Defining τ k (s) and q k (s) as in [START_REF] Michor | Topics in Differential geometry[END_REF] for all s ∈ [0, 1], the path α can be represented by its SRV representation

[0, 1] → M × T α M n+1 , s → x 0 (s), (q k (s)) 0≤k≤n-1 . (16)
To compute the squared norm of its speed vector α (s), consider the path of piecewise geodesic curves

[0, 1] 2 (s, t) → c(s, t) ∈ M such that c(s, k n ) = x k (s) and c t (s, k n ) = nτ k (s)
for all s and k. Then, notice that we have

∇ s q(s, k n ) = ∇ s q k (s), (D τ α (s)) k = 1 n ∇ t c s (s, k n ) = ∇ s τ k (s), (17)
and so the squared norm of the speed vector of α can be expressed in terms of the SRV representation

G n (α (s), α (s)) = |x 0 (s)| 2 + 1 n n-1 k=0 |∇ s q k (s)| 2 .
In the following result, we show that if s → α(s) is the discretization of a path s → c(s) ∈ M of continuous curves, then its energy with respect to G n ,

E n (α) = 1 2 1 0 |x 0 (s)| 2 + 1 n n-1 k=0 |∇ s q k (s)| 2 ds, (18)
gets closer to the energy (6) of c with respect to G as the size of the discretization grows.

Theorem 1 (Convergence of the discrete model to the continuous model) Let s → c(s) be a C 1path of C 2 -curves with non vanishing derivative with respect to t. This path can be identified with an element

(s, t) → c(s, t) of C 1,2 ([0, 1] × [0, 1], M ) such that c t = 0. Consider the C 1 -path in M n+1 , s → α(s) = (x 0 (s), . . . , x n (s))
, that is the discretization of size n of c. Then there exists a constant λ > 0 such that for n large enough, the difference between the energies of c and α is bounded by

|E(c) -E n (α)| ≤ λ n (inf |c t |) -1 |c s | 2 2,∞ (1 + |c t | 1,∞ ) 3 ,
where E and E n are the energies with respect to metrics G and G n respectively and where

|c t | 1,∞ := |c t | ∞ + |∇ t c t | ∞ , |c s | 2,∞ := |c s | ∞ + |∇ t c s | ∞ + |∇ 2 t c s | ∞ , if |w| ∞ := sup s,t∈[0,1]
|w(s, t)| denotes the supremum over both s and t of a vector field w along c.

Remark 4 Note that since we assume that c is a C 1path of C 2 -curves, the following norms are bounded for i = 1, 2,

|c t | ∞ , |c s | ∞ , |∇ i t c t | ∞ , |∇ i t c s | ∞ < ∞.
Proof (Proof of Theorem 1) The proof is put off to Section 5.

Now that we have established a formal Riemannian setting to study discrete curves defined by a series of points, and that we have studied its link to the continuous model, we need to derive the equations of the corresponding geodesics and Jacobi fields to apply the methods described in Section 2. For the sake of readability, we first introduce some notations.

3.2 Computing geodesics in the discrete setting

Notations

The purpose of the notations that we introduce here is to lighten the equations derived in the rest of the paper. For any discrete curve α = (x 0 , . . . , x n ) ∈ M n+1 we define for all 0 ≤ k ≤ n, using the coefficients a k and b k defined by ( 15) and ( 13), the functions f k , g k :

T x k M → T x k M , f k : w → w T + a k w N , g k : w → |q k |(2w T + b k w N ).
and for k = 0, . . . , n -1, the functions f

(-) k , g (-) k : T x k+1 M → T x k M by f (-) k = f k • P x k+1 ,x k γ k , g (-) k = g k • P x k+1 ,x k γ k
, where γ k denotes the geodesic between x k and x k+1 , which we previously assumed existed. Notice that when the discretization gets "thinner", that is n → ∞, |τ k | → 0 while n|τ k | stays bounded for all 0 ≤ k ≤ n, we get in the non flat setting, for any fixed

w ∈ T x k+1 M , f k (w) = w + o(1/n) and g k (w) = |q k |(w + w T ) + o(1/n)
-in the flat setting, these are always equalities. Now if we consider a path s → α(s) = (x 0 (s), . . . , x n (s)) of discrete curves, we can define for each s the functions

f k (s), g k (s) : T x k (s) M → T x k (s) M, f k (s) (-) , g k (s) (-) : T x k+1 (s) M → T x k (s) M,
for 0 ≤ k ≤ n and 0 ≤ k ≤ n -1 respectively, corresponding to the discrete curve α(s). It is of interest for the rest of this paper to compute the covariant derivatives of these maps with respect to s.

Lemma 2

The first and second order covariant derivatives of f k and g k with respect to s are functions

T x k (s) M → T x k (s) M defined by ∇ s f k (w) = ∂ s a k w N + (1 -a k ) w, ∇ s v k v k + w, v k ∇ s v k , ∇ s g k (w) = ∂ s |q k |/|q k |g k (w) + |q k |∂ s b k w N + |q k |(2 -b k ) w, ∇ s v k v k + w, v k ∇ s v k , ∇ 2 s f k (w) = ∂ 2 s a k w N -2∂ s a k w, ∇ s v k v k + w, v k ∇ s v k + (1 -a k ) w, ∇ 2 s v k v k + 2 w, ∇ s v k ∇ s v k + w, v k ∇ 2 s v k , ∇ 2 s g k (w) = ∂ s ∂ s |q k |/|q k | g k (w) + ∂ s |q k |/|q k |∇ s g k (w) + (∂ s |q k |∂ s b k + |q k |∂ 2 s b k )w N + |q k |(2 -b k ) w, ∇ 2 s v k v k + 2 w, ∇ s v k ∇ s v k + w, v k ∇ 2 s v k + ∂ s |q k |(2 -b k ) -2|q k |∂ s b k w, ∇ s v k v k + w, v k ∇ s v k .
Proof For any vector field s → w(s) ∈ T x k (s) M along s → x k (s) we have by definition

∇ s f k (w) = ∇ s f k (w) + f k (∇ s w), ∇ s g k (w) = ∇ s g k (w) + g k (∇ s w), ∇ 2 s f k (w) = ∇ 2 s f k (w) + 2 ∇ s f k (∇ s w) + f k (∇ 2 s w), ∇ 2 s g k (w) = ∇ 2 s g k (w) + 2 ∇ s g k (∇ s w) + g k (∇ 2 s w). Noticing that ∇ s (w T ) = (∇ s w) T + w, ∇ s v k v k + w, v k ∇ s v k and ∇ s (w N ) = ∇ s w -∇ s (w T
), the formulas given in Lemma 2 result from simple calculation.

Using these functions, we can deduce the covariant derivatives of f

∇ s f (-) k : w → (∇ s f k ) (-) (w) + f k R (Y k , τ k ) (w k+1 ) , ∇ s g (-) k : w → (∇ s g k ) (-) (w) + g k R (Y k , τ k ) (w k+1 ) , where (∇ s f k )(s) (-) = ∇ s f k (s) • P x k+1 (s),x k (s) γ k (s) , (∇ s g k )(s) (-) = ∇ s g k (s) • P x k+1 (s),x k (s) γ k (s) , Y k = (x k ) T + b k (x k ) N + 1 2 ∇ s τ k T + K 1 -a k |τ k | 2 ∇ s τ k N , ( 19
)
if K is the sectional curvature of the base manifold.

Proof The proof is given in Appendix A.

Geodesic equations and exponential map

With these notations, we can characterize the geodesics for metric G n . The geodesic equations can be derived in a similar way as in the continuous case, that is by searching for the critical points of the energy [START_REF] Su | Comparing Curves in Homogeneous Spaces[END_REF]. We obtain the following characterization in terms of the SRV representation [START_REF] Srivastava | Functional and Shape Data Analysis[END_REF].

Proposition 7 (Discrete geodesic equations) A path s → α(s) = (x 0 (s), . . . , x n (s)) in M n+1 is a geodesic for metric G n if and only if its SRV representation s → x 0 (s), (q k (s)) k verifies the following differential equations

∇ s x 0 + 1 n R 0 + f (-) 0 (R 1 ) + . . . + f (-) 0 • • • • • f (-) n-2 (R n-1 ) = 0, ∇ 2 s q k + 1 n g (-) k R k+1 + f (-) k+1 (R k+2 ) + . . . + f (-) k+1 • • • • • f (-) n-2 (R n-1 ) = 0, (20)
for all k = 0, . . . , n -1, with the notations (13) and

R k := R(q k , ∇ s q k )x k .
Proof The proof is given in Appendix B.

Remark 5 (Link with the continuous setting)

Let [0, 1] s → c(s, •) ∈ M be a C 1 path of smooth curves and [0, 1] s → α(s) ∈ M n+1
the discretization of size n of c. We denote as usual by q := c t /|c t | 1/2 and (q k ) k their respective SRV representations. When n → ∞ and |τ k | → 0 while n|τ k | stays bounded for all 0 ≤ k ≤ n, the coefficients of the discrete geodesic equation [START_REF] Younes | Computable elastic distances between shapes[END_REF] for α converge to the coefficients of the continuous geodesic equation ( 7) for c, i.e.

∇ s x 0 (s) = -r 0 (s) + o(1),

∇ 2 s q k (s) = -|q k (s)|(r k (s) + r k (s) T ) + o(1),
for all s ∈ [0, 1] and k = 0, . . . , n -1, where r n-1 = 0 and for k = 1, . . . , n -2,

r k (s) := 1 n n-1 =k+1 P l n , k n c R(q, ∇ s q)c s (s, n ) → n→∞ r(s, k n ),
with the exception that the sum starts at = 0 for r 0 . More details on this can be found in Appendix B.

Remark 6 (Euclidean case and existence of geodesics) Just as in the continuous case, when M = R d , the curvature terms R k 's vanish and we obtain

x 0 (s) = 0, q k (s) = 0, k = 0, . . . , n -1, ∀s ∈ [0, 1],
i.e. the geodesics are composed of straight lines in the SRV coordinates. We can again avoid the problem of the q k (s)'s going through zero by allowing two consecutive components x k and x k+1 to be equal, and setting q k = 0 when that happens. In that case, we get a complete finite-dimensional manifold, which is by the Hopf-Rinow theorem geodesically complete, i.e. any two curves can be linked by a minimizing geodesic. Indeed, since the SRV coordinates of geodesics are straight lines, a sequence in (R d ) n+1 converges if and only if its SRV coordinates x 0 , q 0 , . . . , q n-1 converge in R d (the sequence subscript is omited), and so the completeness of (R d ) n+1 follows from that of R d . The question of whether this property still holds in the non flat case is postponed to future work.

Using equations [START_REF] Younes | Computable elastic distances between shapes[END_REF] we can now build the exponential map, that is, an algorithm allowing us to approximate the geodesic of M n+1 starting from a point (x 0 0 , . . . , x 0 n ) ∈ M n+1 at speed (u 0 , . . . , u n ) with u k ∈ T x k M for all k = 0, . . . , n. In other words, we are looking for a path [0, 1] s → α(s) = (x 0 (s), . . . , x n (s)) such that x k (0) = x 0 k and x k (0) = u k for all k, and that verifies the geodesic equations [START_REF] Younes | Computable elastic distances between shapes[END_REF]. Assume that we know at time s ∈ [0, 1] the values of x k (s) and x k (s) for all k = 0, . . . , n. Then we propagate using

x k (s + ) = log x k (s) x k (s), x k (s + ) = (x k (s) + ∇ s x k (s))
s,s+ .

In the following proposition, we see how we can compute the acceleration ∇ s x k for each k.

Proposition 8 (Discrete exponential map) Let [0, 1] s → α(s) = (x 0 (s), . . . , x n (s)) be a geodesic path in M n+1 . For all s ∈ [0, 1], the coordinates of its acceleration ∇ s α (s) can be iteratively computed in the following way

∇ s x 0 = - 1 n R 0 + f (-) 0 (R 1 ) + . . . + f (-) 0 • • • • • f (-) n-2 (R n-1 ) , ∇ s x k+1 = ∇ s f k (x k ) + f k (∇ s x k ) + 1 n ∇ s g k (∇ s q k ) + 1 n g k (∇ 2 s q k ) + R(τ k , Y k )(x k+1 ),
for k = 0, . . . , n -1, where the R k 's are defined as in Proposition 7, the symbol • denotes the parallel transport from x k+1 (s) back to x k (s) along the geodesic linking them, the maps ∇ s f k and ∇ s g k are given by Lemma 2, Y k is given by Equation [START_REF] Tumpach | Quotient elastic metrics on the manifold of arc-length parameterized plane loops[END_REF] and

∇ s τ k = (D τ α ) k , ∇ s v k = 1 |τ k | ∇ s τ k -∇ s τ k T , ∇ s q k = n |τ k | ∇ s τ k - 1 2 ∇ s τ k T , ∇ 2 s q k = - 1 n g (-) k R k+1 + f (-) k+1 (R k+2 ) + . . . + f (-) k+1 • • • • • f (-) n-2 (R n-1 ) .
Proof The proof is given in Appendix B.

The equations of Proposition 8 allow us to iteratively construct a geodesic s → α(s) in M n+1 for metric G n from the knowledge of its initial conditions α(0) and α (0). The next step is to construct geodesics under boundary constraints, i.e. to find the shortest path between two elements α 0 and α 1 of M n+1 .

Jacobi fields and geodesic shooting

As explained in Section 2.2.2 for the continuous model, we solve the boundary value problem using geodesic shooting. To do so, recall that we need to characterize the Jacobi fields for the metric G n , since these play a role in the correction of the shooting direction at each iteration of the algorithm. Recall also that for any geodesic s → α(s) in M n+1 and Jacobi field s → J(s) along α, there exists a family of geodesics (-δ, δ) a → α(a, •) such that α(0, s) = α(s) for all s and

J(s) = ∂ ∂a a=0 α(a, s).
Proposition 9 (Discrete Jacobi fields) Let [0, 1] s → α(s) = (x 0 (s), . . . , x n (s)) be a geodesic path in M n+1 , [0, 1] s → J(s) = (J 0 (s), . . . , J n (s)) a Jacobi field along α, and (-δ, δ) a → α(a, •) a corresponding family of geodesics, in the sense just described. Then J verifies the second order linear ODE

∇ 2 s J 0 = R(x 0 , J 0 )x 0 - 1 n ∇ a R 0 + f (-) 0 (∇ a R 1 ) + . . . + f (-) 0 • • • • • f (-) n-2 (∇ a R n-1 ) - 1 n n-2 k=0 k =0 f (-) 0 • • • • • ∇ a f (-) • • • • • f (-) k (R k+1 ), ∇ 2 s J k+1 = f k (∇ 2 s J k ) + 2∇ s f k (∇ s J k ) + ∇ 2 s f k (J k ) + 1 n g k (∇ 2 s ∇ a q k ) + 2 n ∇ s g k (∇ s ∇ a q k ) + 1 n ∇ 2 s g k (∇ a q k ) + 2R(τ k , Y k )(∇ s J k+1 ) + R(∇ s τ k , Y k )(J k+1 ) + R(τ k , ∇ s Y k )(J k+1 ) + R(τ k , Y k ) R(Y k , τ k )(J k+1 ) , for all 0 ≤ k ≤ n -1, where R k := R(q k , ∇ s q k )
x k and the various covariant derivatives according to a can be expressed as functions of J and ∇ s J,

∇ a R k = R ∇ a q k , ∇ s q k x k + R q k , ∇ s ∇ a q k + R(J, x k )q k x k + R q k , ∇ s q k )∇ s J k , ∇ a q k = n |τ k | ∇ a τ k - 1 2 ∇ a τ k T , ∇ a τ k = (D τ J) k , ∇ a v k = 1 |τ k | ∇ a τ k -∇ a τ k T , ∇ s ∇ a q k = n g k -1 (∇ s J k+1 ) + R(Y k , τ k )(J k+1 ) -∇ s f k (J k ) -f k (∇ s J k ) + n ∇ s g k -1 J k+1 -f k (J k ) , ∇ 2 s ∇ a q k = - 1 n n-1 =k+1 g (-) k • f (-) k+1 • • • • • f (-) -1 (∇ a R ) + R(∇ s x k , J k )q k + R(x k , ∇ s J k )q k + 2R(x k , J k )∇ s q k - 1 n n-1 =k+1 -1 j=k g (-) k • • • • • ∇ a f (-) j • • • • • f (-) -1 (R ), ∇ s Y k = (∇ s x k ) T + b k (∇ s x k ) N + ∂ s b k (x k ) N + (1 -b k ) x k , ∇ s v k v k x k , v k ∇ s v k + 1 2 (∇ 2 s τ k ) T + K 1 -a k |τ k | 2 (∇ 2 s τ k ) N + ∂ s K 1 -a k |τ k | 2 (∇ s τ k ) N + 1 2 -K 1 -a k |τ k | 2 ( ∇ s τ k , ∇ s v k v k + ∇ s τ k , v k ∇ s v k ),
with the notation conventions f

(-) k+1 • . . . • f (-) k-1 := Id, n-1
=n := 0 and with the maps

∇ a f (-) k (w) = (∇ a f k ) (-) (w) + f k R(Z k , τ k )(w k+1 ) , ∇ a g (-) k (w) = (∇ a g k ) (-) (w) + g k R(Z k , τ k )(w k+1 ) , ∇ s g k -1 (w) = ∂ s |q k | -1 |q k |g k -1 (w) +|q k | -1 ∂ s (b -1 k ) w N + |q k | -1 1/2 -b -1 k w, ∇ s v k v k + w, v k ∇ s v k , and
Z k = J k T + b k J k N + 1 2 ∇ a τ k T + K 1 -a k |τ k | 2 ∇ a τ k N .
Proof The proof is given in Appendix B.

The equations of Proposition 9 allow us to iteratively compute the Jacobi field J along a geodesic α -and in particular, its end value J(1) -from the knowledge of the initial conditions {J k (0), 0 ≤ k ≤ n} and {∇ s J k (0), 0 ≤ k ≤ n}. Indeed, if at time s ∈ [0, 1] we have J k (s) and ∇ s J k (s) for all k = 0, . . . , n, then we can propagate using

J k (s + ) = J k (s) + ∇ s J k (s) x k ,x k+1 , ∇ s J k (s + ) = ∇ s J k (s) + ∇ 2 s J k (s) x k ,x k+1 ,
where ∇ 2 s J k (s) is deduced from ∇ 2 s J k-1 (s) using Proposition 9. We can now apply Algorithm 1, where we replace the smooth geodesic equations ( 7) by the discrete geodesic equations ( 20) and we solve them using the exponential map described in Proposition 8. Notice that in M n+1 , the k th component of the L 2logarithm map between two elements α 0 = (x 0 0 , . . . , x 0 n ) and α 1 = (x 1 0 , . . . , x 1 n ) is given by log x 0 k (x 1 k ). Algorithm 3 (Discrete geodesic shooting) Input: α 0 = (x 0 0 , . . . , x 0 n ), α 1 = (x 1 0 , . . . , x 1 n ). Initialization: w = log L 2 α0 (α 1 ). Repeat until convergence :

1. compute the geodesic s → α(s) starting from α 0 at speed w using Proposition 8, 2. evaluate the difference j := log L 2 α(1) (α 1 ) between the target curve α 1 and the extremity α(1) of the obtained geodesic, 3. compute the initial derivative ∇ s J(0) of the Jacobi field s → J(s) along α verifying J(0) = 0 and J(1) = j using Proposition 9, 4. correct the shooting direction w = w + ∇ s J(0).

Output : geodesic α(s).

Recall that the map ϕ : T α(0) M → T α(1) M, ∇ s J(0) → J(1) associating to the initial derivative ∇ s J(0) of a Jacobi field with initial value J(0) = 0 its end value J(1), is a linear bijection between two vector spaces which can be obtained using Proposition 9. Its inverse map can be computed by considering the image of a basis of T c(0) M.

A discrete analog of unparameterized curves

The final step in building our discrete model is to introduce a discretization of the quotient shape space. There seems to be no natural, intrinsic definition of the shape of a discrete curve, as by definition we are lacking information : we only have access to a finite number n + 1 of points. Therefore we will make the assumption that we know the equations of the underlying curves, that is, that for each discrete curve α, we have access to the shape ᾱ of the smooth curve of which α is the discretization. In practice, we can set ᾱ to be the shape of an optimal interpolation. The goal, for two elements α 0 , α 1 of shapes α 0 , α 1 , is to redistribute the n + 1 points on α 1 to minimize the discrete distance to the n + 1 points α 0 on α 0 , and obtain

α opt 1 = argmin{d n (α 0 , α) | α has shape c 1 }, (21)
where d n is the geodesic distance associated to the discrete metric G n . We approximate α opt 1 using Algorithm 2, i.e. by iteratively computing the "horizontal part" of the geodesic linking α 0 to an iteratively improved discretization of α 1 . Since there is no "discrete shape bundle", we simply define the vertical and horizontal spaces in α as the discrete analogs of the ones of the smooth case

Ver n α := {mv : m = (m k ) k ∈ R n+1 , m 0 = m n = 0}, Hor n α := {h ∈ T α M n+1 : G n (h, mv) = 0 ∀m = (m k ) k ∈ R n+1 , m 0 = m n = 0},
where v = (v k ) k is still defined by [START_REF] Michor | Topics in Differential geometry[END_REF]. Similarly to the continuous case, we can show the following result.

Proposition 10 (Discrete horizontal space) Let α ∈ M n+1 and h ∈ T α M n+1 . Then h ∈ Hor n α if and only if it verifies

(D τ h) k , v k -4 |τ k | |τ k-1 | (D τ h) k-1 , b -1 k-1 v k + ( 1 4 -b -1 k-1 )λ k-1 v k-1 = 0.
with the notation λ k := v k+1 , v k . Any tangent vector w ∈ T α M n+1 can be uniquely decomposed into a sum w = w ver + w hor where w ver = mv ∈ Ver n α , w hor = w -mv ∈ Hor n α and the components (m k ) k verify m 0 = m 1 = 0 and the following recurrence relation

A k m k+1 + B k m k + C k m k-1 = D k , (22)
with coefficients

A k = λ k , B k = -1 -4 |τ k | |τ k-1 | (b -2 k-1 + λ 2 k-1 ( 1 4 -b -2 k-1 )), C k = |τ k | |τ k-1 | λ k-1 , D k = (D τ w) k , v k -4 |τ k | |τ k-1 | b -1 k-1 (D τ w) k-1 , v k + ( 1 4 -b -1 k-1 )λ k-1 (D τ w) k-1 , v k-1 .
Proof Let h ∈ T α M be a tangent vector. It is horizontal if and only if it is orthogonal to any vertical vector, that is any vector of the form mv with m = (m k ) k ∈ R n+1 such that m 0 = m n = 0. Recall that by definition

(D τ w) k := (w k+1 -w k ) T + b -1 k (w k+1 -a k w k ) N ,
and so with the notation λ k := v k+1 , v k , we get

(D τ (mv)) T k = m k+1 (v k+1 ) T -m k v k = (m k+1 λ k -m k )v k , (D τ (mv)) N k = b -1 k m k+1 (v k+1 ) N = b -1 k m k+1 (v k+1 -λ k v k ).
The scalar product between h and mv is then

G n α (h, mv) = n-1 k=0 b -1 k m k+1 (D τ h) k , v k+1 -λ k v k + 1 4 (m k+1 λ k -m k ) (D τ h) k , v k |τ k | -1 = n-1 k=0 m k+1 |τ k | b -1 k (D τ h) k , v k+1 -λ k v k + 1 4 λ k (D τ h) k , v k -1 4 n-1 k=0 m k |τ k | (D τ h) k , v k .
Changing the indices in the first sum and taking into account that m 0 = m n = 0, we obtain

n-1 k=1 m k |τ k-1 | -1 (D τ h) k-1 , b -1 k-1 v k + ( 1 4 -b -1 k-1 )λ k-1 v k-1 -1 4 |τ k | -1 (D τ h) k , v k = 0.
Since this is true for all such m the summand is equal to zero for all k and we get the desired equation. The decomposition of a tangent vector w into a vertical part mv and a horizontal part w -mv with m = (m k ) k ∈ R n+1 such that m 0 = m n = 0, is then simply characterized by the fact that w -mv verifies this equation.

In the discrete case, soving the ODE (8) to find the horizontal part of a vector simply boils down to solving the recurrence relation [START_REF] Younes | Spaces and manifolds of shapes in computer vision: an overview[END_REF], allowing us to compute the coefficients of the PDE [START_REF] Michor | An overview of the Riemannian metrics on spaces of curves using the Hamiltonian approach[END_REF]. Now we present an algorithm to solve a discrete version of this PDE and compute the discrete analog of the horizontal part of a (discrete) path of discrete curves.

Algorithm 4 (Horizontal part of a path)

Input : α(s) = (x 0 (s), . . . , x n (s)), s = 0, 1 m , . . . , 1. Initialization : for k = 0, . . . , n,

ϕ(0)( k n ) = k n , x hor k (0) = x k (0).
For j = 0, . . . , m -1,

1. set s = j/m, m 0 (s) = m n+1 (s) = 0 and solve       B 1 A 1 • • • 0 C 2 . . . . . . . . . . . . . . . . . . A n-2 0 • • • C n-1 B n-1             m 1 . . . . . . m n-1       =       D 1 . . . . . . D n-1       , 2. for k = 0, . . . , n, ∆ϕ(s)( k n ) = n ϕ(s)( k+1 n ) -ϕ(s)( k n ) if m k ≥ 0, n ϕ(s)( k n ) -ϕ(s)( k-1 n ) if m k < 0, ϕ s (s)( k n ) = m k (s) |nτ k (s)| ∆ϕ(s)(k), ϕ(s + 1 m )( k n ) = ϕ(s)( k n ) + 1 m ϕ s (s)( k n ),
3. interpolate between the {x k (s + 1 m ), k = 0, . . . , n} to obtain N + 1 values {y (s + 1 m ), = 0, . . . , N } and interpolate between the {ϕ(s

+ 1 m )( k n ), k = 0, . . . , n} to obtain N + 1 values {ψ(s + 1 m )( n ), = 0, . . . , N }, 4. for k = 0, . . . , n, find s.t. k n ≤ ψ(s + 1 m )( N ) < k+1 n , set x hor k (s + 1 m ) = y (s + 1 m ).
Output: α hor (s) = (x hor 0 (s), .., x hor n (s)), s = 0, 1 m , . . . , 1.

Step 1 computes the coefficients of the PDE. The A k , B k , C k , D k are computed using the definitions of Proposition 10 for w = α (s), i.e. (D τ α (s)) k = ∇ s τ k (s). Step 2 solves the PDE. The increment ∆ϕ is a discretization of the t-derivative, and so it is crucial to make it depend on the sign of m in order to follow the characteristic curves. Steps 3 and 4 simply inverse the reparameterization ϕ obtained after step 2 in order to deduce the horizontal part of α. It is important to note that for s = 1, interpolation between the points {x k (s), k = 0, . . . , n} should be achieved so as to remain on the initial shape α(1), obtained e.g. by spline interpolation of the points of α(1). Finally, we can perform optimal matching in the discrete case.

Algorithm 5 (Discrete optimal matching) Input: α 0 = (x 0 0 , . . . , x 0 n ), α 1 = (x 1 0 , . . . , x 1 n ). Initialization : α1 = α 1 . Repeat until convergence :

1. compute geodesic s → α(s) = (x 0 (s), . . . , x n (s)) between α 0 and α1 using Algorithm 3, 2. compute s → α hor (s) = (x hor 0 (s), . . . , x hor n (s)) the horizontal part of α using Algorithm 4, 3. set α1 = α hor (1).

Output : α opt 1 = α1 .

Simulations

We test the optimal matching (OM) algorithm in several settings : for curves in the hyperbolic half-plane H 2 , for curves in R 2 and R 3 , and for curves on the sphere S 2 . Regarding the geometry of H 2 and the useful algorithms such as the exponential map and the logarithm map, we refer the reader to [START_REF] Brigant | Computing distances and geodesics between manifold-valued curves in the SRV framework[END_REF]. Concerning the geometry of S 2 , we have used the same formulas as those given in appendix in [START_REF] Zhang | Phase-amplitude separation and modeling of spherical trajectories[END_REF]. We start by comparing Algorithm 5 to the popular dynamic programming (DP) method, presented e.g. in [START_REF] Srivastava | Functional and Shape Data Analysis[END_REF]. This alternative approach to optimal matching between two curves c 1 and c 2 considers a discrete grid of [0, 1]×[0, 1] and tries to find the optimal non-decreasing path ϕ(t) in that grid that puts into correspondence c 1 (t) and c 2 (ϕ(t)). To do so, at each point (t 1 , t 2 ) of the grid, it tests all the possible matchings between the pieces of curves c 1 ([0, t 1 ]) and c 2 ([0, t 2 ]), and keeps only the one that gives the shortest geodesic. This boils down to testing all the non-decreasing paths that lead to this point. Since this is computationally costly, the algorithm only tests the paths going through the points located at the bottom-left in a square of a certain size, as shown in Figure 6. Even though the computations are additive, this method requires to compute a large number of geodesics. Results of comparison of Algorithm 5 to this method are shown in Figure 8 for a pair of curves in R 2 and three pairs of curves in R 3 . The DP method is carried out for a square of side s = 7. The first row displays the geodesics between the initial parameterized curves (which are all arc-length parameterized except for the second example) and the second and third rows the horizontal geodesics obtained with the optimal matching and dynamic programing algorithms respectively. We can see that the two methods give very similar results : in the first example, at each extremity, a portion of the circle is matched to almost a single point of the segment, in order to maximize the portions in correspondence where the speeds are positively colinear. In the second example, we consider two curves in R 3 that are identical modulo translation and parameterization. This difference in the parameterization induces an artificial deformation of the geodesic (first row), which is "straightened out" in the horizontal geodesics given by both methods. The last two examples illustrate the fact that arc-length parameterization does not always yield a relevant matching : in the third example, it seems more natural to put into correspondence the portions of the curves that are "before the turn", and to match together the ones that are "after the turn", as given by both the OM algorithm and DP. The fourth row shows the corresponding optimal matchings, i.e. the optimal reparameterizations ϕ such that c 1 (t) is matched to c 2 (ϕ(t)), in red (OM) and black (DP), and we can check in the fifth row the horizontality of the solutions by looking at the ratio, in norm, of the vertical part of the speed vector of the geodesic divided by its horizontal part. We can see that this ratio is largely reduced from the initial geodesic (dashed black line) to the horizontal ones (full red and black lines). Finally, the lengths of the geodesics of the first three lines of Figure 8 are given in Table 1 in the corresponding order, showing that the horizontal geodesics are indeed shorter. The lengths on the first row give the distance between the initial parameterized curves, while the lengths on the second and third row yield a distance between the shapes.

To summarize, it seems that both methods give very similar results when tested on the same metric : they both tend to put into correspondence the parts of the curves that have same shape and orientation. However the dynamic programing approach requires the computation of a large number of geodesics between pieces of curves, whereas in the examples shown here (Figures 9 to 11), the number of iterations required range from 4 to 12, resulting in the same amount of geodesic computations. It should also be noted that it is usually the first iteration that gives the biggest "jump" on the fiber, i.e. that results in the most important reparameterization of the target curve. It could therefore also be used to get a good initialization for some approximate faster method.

We then consider examples where the base manifold has negative curvature. Figure 9 shows horizontal geodesics obtained using the OM algorithm as well as the corresponding optimal matchings in [0, 1] × [0, 1], for plane curves (first row) and the same curves taking their values in the hyperbolic half-plane (second row). We can see that the geometry of the base manifold significantly influences the optimal matching between two given curves. To evaluate the performance of the geodesic shooting algorithm used to perform OM, we display in Figure 7 the evolution of the norm of the speed of the geodesic obtained for the two curves on the bottom-right corner of Figure 9 (the vertical and horizontal segments of H2 ) as the number of points used to compute the geodesic increases (from 20 to 500). The evolutions of the maximum and minimum values max s∈[0,1] |c s (s)|, min s∈[0,1] |c s (s)| are shown in dashed lines, and that of the mean value with a full line. We can see that the more refined the discretization, the closer we get to a geodesic. It is to be noted that these two segments are the same as those considered in [START_REF] Su | Comparing Curves in Homogeneous Spaces[END_REF] to illustrate an extension of the SRV framework to curves in Lie groups. Since this metric structure coincides with the one studied here in the planar case, it is not surprising to find similar results for the plane curves. However, the results in H 2 are quite different.

Finally, we show illustrations on the sphere. Figure 10 shows geodesics before (top row) and after (bottom row) optimal matching, for two pairs of curves representing hurricane tracks from the NASA Tropical Storm Tracks Database 1 . Once again we can see that the optimal matching algorithm seems to "flatten out" the deformation between two curves. In the last figure, we show a set of plane trajectories between Paris and Caracas downloaded from the IAGOS-MOZAIC database 2 . It is visually clear that there are two clusters, probably due to different weather conditions. These clusters are easily retrieved using agglomerative hierarchical clustering based on the horizontal geodesic distance. We can find the centers of these clusters by computing the Fréchet means, i.e. for each cluster, the curve that mini-Fig. 8 Optimal matching between curves in R 2 or R 3 in the SRV framework achieved using Algorithm 5 compared to dynamic programming. The first line shows the geodesics between the initial parameterizations, the second line the horizontal geodesics obtained with Algorithm 5, the third line the horizontal geodesics obtained with dynamic programming, the fourth line the optimal matchings for our method (in red) and dynamic programming (in black). The fifth line shows the ratio vertical/horizontal, in norm, of the speed of the initial geodesic (dashed line), the horizontal geodesic obtained with Algorithm 5 (red) and the horizontal geodesic obtained with dynamic programming (black). Table 1 Length of the geodesics shown in the first three lines of Figure 8, displayed in the same order. mizes the sum of the squared distances to all the curves of the cluster. This can be achieved using a Karcher flow algorithm, summarized as follows.

Algorithm 6 (Karcher flow) Input: α 1 , . . . , α N . Initialization : α = α 1 . Repeat until convergence :

1. for i = 1, . . . , N , compute the horizontal geodesic s → α hor (s) from α to α i using Algorithm 5,

-set w i = (α hor ) (0), -update α i = α hor (1). 2. set w = 1 N N i=1 w i , 3. update α = exp α w. Output : α.
The obtained mean curves are shown on the right-hand side of Figure 11.

Proof of Theorem 1

We conclude this paper with the proof of Theorem 1. Let us first remind the result.

Theorem 1 Let s → c(s) be a C 1 -path of C 2 -
curves with non vanishing derivative with respect to t. This path can be identified with an element (s, t) → c(s, t) of C 1,2 ([0, 1] × [0, 1], M ) such that c t = 0. Consider the C 1 -path in M n+1 , s → α(s) = (x 0 (s), . . . , x n (s)), that is the discretization of size n of c. Then there exists a constant λ > 0 such that for n large enough, the difference between the energies of c and α is bounded by

|E(c) -E n (α)| ≤ λ n (inf |c t |) -1 |c s | 2 2,∞ (1 + |c t | 1,∞ ) 3 ,
where E and E n are the energies with respect to metrics G and G n respectively and where

|c t | 1,∞ := |c t | ∞ + |∇ t c t | ∞ , |c s | 2,∞ := |c s | ∞ + |∇ t c s | ∞ + |∇ 2 t c s | ∞ ,
and |w| ∞ := sup s,t∈[0,1] |w(s, t)| denotes the supremum over both s and t of a vector field w along c.

Proof (Proof of Theorem 1)

To prove this result, we introduce the unique path ĉ of piecewise geodesic curves of which α is the n-discretization. It is obtained by linking the points x 0 (s), x 1 (s), . . . , x n (s) of α by pieces of geodesics for all times s ∈ [0, 1]

ĉ(s, k n ) = c(s, k n ) = x k (s), ĉ(s, •)| [ k n , k+1
n ] is a geodesic, for k = 0, . . . , n. Then the difference between the energy of the path of curves E(c) and the discrete energy of the path of discrete curves E n (α) can be controlled in two steps :

|E(c) -E n (α)| ≤ |E(c) -E(ĉ)| + |E(ĉ) -E n (α)|.
Step 1. We first consider the difference between the continuous energies of the smooth and piecewise geodesic curves

|E(c) -E(ĉ)| = 1 0 1 0 |∇ s q(s, t)| 2 -|∇ s q(s, t)| 2 dt ds ≤ 1 0 1 0 |∇ s q(s, t)| 2 -|∇ s q(s, t)| 2 dt ds ≤ 1 0 1 0 (|∇ s q(s, t)| + |∇ s q(s, t)|) • |∇ s q(s, t) t, k n -∇ s q(s, t) t, k n |dt ds.
Note that the parallel transports ∇ s q(s, t) t, k n and ∇ s q(s, t) t, k n are performed along different curvesc(s, •) and ĉ(s, •) respectively. Let us fix s ∈ [0, 1], 0 ≤ k ≤ n and t ∈ k n , k+1 n . From now on we will omit "s" in the notation w(s, t) to lighten notations. Using the notation w (t) := w(t) t, k n to denote the parallel transport of a vector field w from t to k n along its baseline curve, the difference we need to control is

|∇ s q -∇ s q | = |c t | -1 2 (∇ s c t -1 2 ∇ s c t T ) -|ĉ t | -1 2 (∇ s ĉt -1 2 ∇ s ĉt T ) = (∇ s c t -1 2 ∇ s c t T ) (|c t | -1 2 -|ĉ t | -1 2 ) + |ĉ t | -1 2 (∇ s c t -∇ s ĉt ) -1 2 (∇ s c t -∇ s ĉt ) T . Since |w -1
2 w T | ≤ |w| for any vector w, we can write

|∇ s q -∇ s q | ≤ |∇ s c t | • |c t | -1/2 -|ĉ t | -1/2 + |ĉ t | -1/2 |∇ s c t -∇ s ĉt |. (23)
Let us first consider the difference

|c t -ĉ t |. Since ĉt (t) t, k n = ĉt ( k n ), we can write |c t (t) t, k n -ĉt (t) t, k n | ≤ |c t (t) t, k n -c t ( k n )| + |c t ( k n ) -ĉt ( k n )|. The first term is smaller than 1/n • |∇ t c t | ∞ . To bound the second term, we place ourselves in a local chart (ϕ, U ) centered in c( k n ) = c(s, k n ), such that c([0, 1] × [0, 1]) ⊂ U . After identification
with an open set of R d -where d is the dimension of the manifold M -using this chart, we get

|c t ( k n ) -ĉt ( k n )| ≤ c t ( k n ) -n c( k+1 n ) -c( k n ) + ĉt ( k n ) -n c( k+1 n ) -c( k n ) .
Since a geodesic locally looks like a straight line (see e.g. [START_REF] Émery | Fonctions convexes et semimartingales dans une variété[END_REF]) there exists a constant λ 1 such that

ĉt ( k n ) -n(c( k+1 n ) -c( k n )) ≤ λ 1 c( k+1 n ) -c( k n ) 2 ,
and so

|c t ( k n ) -ĉt ( k n )| ≤ 1 2n |c tt | ∞ + λ1 n |c t | 2 ∞ .
The second derivative in t of the coordinates of c in the chart (U, ϕ) can be written c tt = ∇ t c t -Γ ij c t i c t j for = 1, . . . , d, and so there exists a constant λ 2 such that

|c tt | ≤ λ 2 |∇ t c t | ∞ + |c t | 2
∞ , and

c t -ĉ t ≤ λ3 n |c t | 1,∞ + |c t | 2 1,∞ . (24)
This means that for n large enough, we can write e.g.

1 2 inf |c t | ≤ |ĉ t | ≤ 3 2 |c t | ∞ . (25)
From [START_REF] Zhang | Phase-amplitude separation and modeling of spherical trajectories[END_REF] we can also deduce that

|c t | -1 2 -|ĉ t | -1 2 = |c t | -|ĉ t | |c t | 1 2 + |ĉ t | 1 2 ≤ |c t -ĉ t | |c t | 1 2 + |ĉ t | 1 2 ≤ λ3 n (inf |c t |) -1 2 |c t | 1,∞ + |c t | 2 1,∞ . (26)
Let us now consider the difference

|∇ s c t -∇ s ĉt |. Since c s (s, k n ) = ĉs (s, k n ), we get |∇ s c t (t) t, k n -∇ s ĉt (t) t, k n | ≤ ∇ t c s (t) t, k n -∇ t c s ( k n ) + ∇ t c s ( k n ) -n c s ( k+1 n ) k+1 n , k n -c s ( k n ) + ∇ t ĉs (t) t, k n -∇ t ĉs ( k n ) + ∇ t ĉs ( k n ) -n ĉs ( k+1 n ) k+1 n , k n -ĉs ( k n )
and so

|∇ s c t (t) t, k n -∇ s ĉt (t) t, k n | ≤ 3 2n |∇ 2 t c s | ∞ + 3 2n |∇ 2 t ĉs | ∞ . (27)
We can decompose

∇ 2 t ĉs (s, t) = ∇ t ∇ s ĉt (s, t) = ∇ s ∇ t ĉt (s, t) + R(ĉ t , ĉs )ĉ t (s, t), and since ∇ t ĉt (s, t) = 0 and |R(X, Y )Z| ≤ |K| • (| Y, Z ||X| + | X, Z, ||Y |) ≤ 2|K| • |X| • |Y | • |Z|
by Cauchy Schwarz, we get using Equation (25)

|∇ 2 t ĉs | ≤ 2 |ĉ t | 2 |ĉ s | ≤ 9 2 |c t | 2 ∞ |ĉ s |. (28)
To bound |ĉ s | we apply Lemma 1 to the Jacobi field

J : [0, 1] u → ĉs (s, k+u n ) along the geodesic γ(u) = ĉ(s, k+u n ), that is J(u) u,0 = J(0) T + a k (u)J(0) N + u∇ t J(0) T + b k (u)∇ t J(0) N (29)
where, since γ (0) = 1 n ĉt (s, k n ) = τ k (s), the coefficients are defined by

     a k (u) = cosh(|τ k |u) , b k (u) = sinh(|τ k |u) |τ k | , K = -1, a k (u) = 1, b k (u) = u, K = 0, a k (u) = cos(|τ k |u) , b k (u) = sin(|τ k |u) |τ k | , K = +1. This gives J(1) 1,0 = J(0) T + a k (1)J(0) N + ∇ t J(0) N + b k (1)∇ t J(0) N and so ∇ t J(0) T = J(1) 1,0 -J(0) T ∇ t J(0) N = b k (1) -1 J(1) 1,0 -a k (1)J(0) N .
Injecting this into (29), we obtain since u = nt -k and ĉs (s

, k n ) = c s (s, k n ), ĉs (t) t, k n = c s ( k n ) T + a k (nt -k)c s ( k n ) N + (nt -k) c s ( k+1 n ) k+1 n , 1 n -c s ( k n ) T + b k (nt-k) b k (1) c s ( k+1 n ) k+1 n , 1 n -a k (1)c s ( k n ) N . (30) When n → ∞, a k (1) → 1, b k (1) → 1, and since 0 ≤ nt- k ≤ 1, a k (nt -k) → 1, b k (nt -k) → 1 also. Therefore, for n large enough we can see that |ĉ s | ≤ λ 4 |c s | ∞ for some constant λ 4 .
Injecting this into (28) gives

|∇ 2 t ĉs | ∞ ≤ 9λ4 2 |c t | 2 ∞ |c s | ∞ ,
and so the difference (27) can be bounded by

|∇ s c t -∇ s ĉt | ≤ 3 2n |∇ 2 t c s | ∞ + 9λ4 2 |c t | 2 ∞ |c s | ∞ ≤ λ5 n |c s | 2,∞ 1 + |c t | 2 1,∞ , (31)
for some constant λ 5 . Injecting (25), ( 26) and (31) in Equation ( 23) we obtain

|∇ s q -∇ s q | ≤ λ3 n (inf |c t |) -1 2 |c s | 2,∞ |c t | 1,∞ + |c t | 2 1,∞ + λ5 √ 2 n (inf |c t |) -1 2 |c s | 2,∞ 1 + |c t | 2 1,∞ , |∇ s q -∇ s q | ≤ λ6 n (inf |c t |) -1 2 |c s | 2,∞ (1 + |c t | 1,∞ ) 2 , (32)
for some constant λ 6 . To conclude this first step, let us bound the sum

|∇ s q| + |∇ s q| = |c t | -1 2 |∇ s c t -1 2 ∇ s c t T | + |ĉ t | -1 2 |∇ s ĉt -1 2 ∇ s ĉt T | ≤ (inf |c t |) -1 2 |∇ t c s | ∞ + √ 2(inf |c t |) -1 2 |∇ t ĉs | ∞ . (33)
Taking the derivative according to t on both sides of (30), we get since

n|τ k (s)| = |ĉ t (s, k n )|, ∇ t ĉs (t) t, k n = |ĉ t ( k n )|e k (nt -k)c s ( k n ) N + n c s ( k+1 n ) -c s ( k n ) T + n a k (nt-k) b k (1) c s ( k+1 n ) -a k (1)c s ( k n ) N , since derivation of the coefficients give b k (u) = a k (u) and a k (u) = |τ k |e k (u) = 1 n |ĉ t ( k n )|e k (u)
, where

e k (u) =    sinh (|τ k |u) , if K = -1, 0 if K = 0, -sin (|τ k |u) , if K = +1.
Since the coefficients e k (nt -k), a k (nt -k)/b k (1) and a k (1) are bounded for n large enough, and since |ĉ t | ≤ 3 2 |c t | ∞ , we can write for some constant λ 7 ,

|∇ t ĉs | ∞ ≤ λ 7 (|ĉ t | ∞ |c s | ∞ + |∇ t c s | ∞ ) ≤ 3λ7 2 |c s | 2,∞ (1 + |c t | 1,∞ ) . (34)
Inserting this into (33) gives

|∇ s q| + |∇ s q| ≤ (inf |c t |) -1/2 |∇ t c s | ∞ + 3λ7 √ 2 |c s | 2,∞ (1 + |c t | 1,∞ ) ≤ λ 8 (inf |c t |) -1/2 |c s | 2,∞ (1 + |c t | 1,∞ ). (35)
Finally, we are able to bound the difference between the energies of the smooth and piecewise-geodesic paths by combining Equations ( 32) and ( 35)

|E(c) -E(ĉ)| ≤ λ 6 λ 8 n (inf |c t |) -1 |c s | 2 2,∞ (1 + |c t | 1,∞ ) 3 .
Step 2. Let us now consider the difference of energy between the path of piecewise geodesic curves and the path of discrete curves. Since ∇ s q k (s) = ∇ s q(s, k n ) for all s ∈ [0, 1] and 0 ≤ k ≤ n, we can write

|E(ĉ) -E n (α)| = 1 0 1 0 |∇ s q(s, t)| 2 dt - 1 n n-1 k=0 |∇ s q k (s)| 2 ds ≤ n-1 k=0 1 0 k+1 n k n |∇ s q(s, t)| 2 -|∇ s q(s, k n )| 2 dt ds ≤ n-1 k=0 1 0 k+1 n k n |∇ s q(s, t)| + |∇ s q(s, k n )| • ∇ s q(s, t) t, k n -∇ s q(s, k n ) dt ds.
We fix once again s ∈ [0, 1], 0 ≤ k ≤ n and t ∈ k n , k+1 n . As in step 1, we will omit "s" in most notations. Since

|ĉ t (t)| = |ĉ t ( k n )|, we get ∇ s q(t) t, k n -∇ s q( k n ) ≤ |ĉ t ( k n )| -1 2 ∇ s ĉt (t) t, k n -∇ s ĉt ( k n ) -1 2 ∇ s ĉt (t) t, k n -∇ s ĉt ( k n ) T ≤ |ĉ t ( k n )| -1 2 ∇ s ĉt (t) t, k n -∇ s ĉt ( k n ) .
Considering once again the Jacobi field

J(u) := ĉs ( k+u n ), u ∈ [0, 1],
along the geodesic γ(u) = ĉ( k+u n ), Equation (29) gives

ĉs (t) t, k n = c s ( k n ) T + a k (nt -k)c s ( k n ) N + (t -k n )∇ t ĉs ( k n ) T + b k (nt -k) 1 n ∇ t ĉs ( k n ) N .
Recall that b k (u) = a k (u) and a k (u) = |τ k |e k (u), and so taking the derivative with respect to t and decomposing

∇ t ĉs ( k n ) T = ∇ t ĉs ( k n ) -∇ t ĉs ( k n ) N , we obtain ∇ t ĉs (t) t, k n -∇ t ĉs ( k n ) = |ĉ t ( k n )|e k (nt -k) • c s ( k n ) N + a k (nt -k) -1 ∇ t ĉs ( k n ) N .
Noticing that e k (nt-k) (nt-k)|τ k | → 1 and a k (nt-k)-1 (nt-k)|τ k | → 0 when n → ∞, we can deduce that for n large enough,

|e k (nt -k)| ≤ 2(nt -k)|τ k | ≤ 2|τ k | = 2 n |c t | ≤ 2 n |c t | ∞ , |a k (nt -k) -1| ≤ (nt -k)|τ k | ≤ |τ k | = 1 n |c t | ≤ 1 n |c t | ∞ .
This gives

k+1 n k n ∇ t ĉs (s, t) t, k n -∇ t ĉs (s, k n 2 )| dt ≤ 2 n 2 |c t | 2 ∞ |c s | ∞ + |c t | ∞ |∇ t ĉs | ∞ .
Recall from (34) and (35) that

|∇ t ĉs | ∞ ≤ 3λ7 2 |c s | 2,∞ (1 + |c t | 1,∞ ) , |∇ s q| ∞ ≤ 3λ7 √ 2 (inf |c t |) -1 2 |c s | 2,∞ (1 + |c t | 1,∞ ) ,
and so

k+1 n k n |∇ s q(t)| + |∇ s q( k n )| • |∇ s q(t) t, k n -∇ s q( k n )| dt ≤ 2|∇ s q| ∞ √ 2(inf |c t |) -1 2 k+1 n k n ∇ t ĉs (t) t, k n -∇ t ĉs ( k n )| dt ≤ 6λ 7 (inf |c t |) -1 |c s | 2,∞ (1 + |c t | 1,∞ ) 2 n 2 |c t | 2 ∞ |c s | ∞ + |c t | ∞ 3λ7 2 |c s | 2,∞ (1 + |c t | 1,∞ ) ≤ λ9 n 2 (inf |c t |) -1 |c s | 2 2,∞ (1 + |c t | 1,∞ ) 3 .
Finally, we obtain

|E(ĉ) -E n (α)| ≤ λ 9 n (inf |c t |) -1 |c s | 2 2,∞ (1 + |c t | 1,∞ ) 3 ,
which completes the proof.

Since

∇ 2 t J T (t) = ∇ 2 t J(t), v(t) v(t) = ∇ 2 t J(t), v(t) v(t) = 0,
the normal component J N is also a Jacobi field, that is it verifies

∇ 2 t J N (t) = -R(J N (t), γ (t))γ (t).
And since M has constant sectional curvature K, for any vector field w along γ we have

R(J N , γ )γ , w = K γ , γ J N , w -J N , γ γ , w = K|γ | 2 J N , w ,
and the differential equation verified by J N can be rewritten ∇ 2 t J N (t) = -K |γ (t)| 2 J N (t). Since the speed of the geodesic γ has constant norm, the solution to that differential equation is of the form J N (t) = λe |γ (0)|t + µe -|γ (0)|t ω(t), when K = -1 and J N (t) = λe i|γ (0)|t + µe -i|γ (0)|t ω(t), when K = 1. Using the initial conditions J N (0) and ∇ t J N (0) to find the constants λ, µ, we get for K = -1

J N (t) = J N (0) cosh (|γ (0)|t) + ∇ t J N (0) sinh(|γ (0)|t) |γ (
∇ s f (-) k : w → (∇ s f k ) (-) (w) + f k R (Y k , τ k ) (w k+1 ) , ∇ s g (-) k : w → (∇ s g k ) (-) (w) + g k R (Y k , τ k ) (w k+1 ) , where (∇ s f k )(s) (-) = ∇ s f k (s) • P x k+1 (s),x k (s) γ k (s) , (∇ s g k )(s) (-) = ∇ s g k (s) • P x k+1 (s),x k (s) γ k (s) , Y k = (x k ) T + b k (x k ) N + 1 2 ∇ s τ k T + K 1 -a k |τ k | 2 ∇ s τ k N ,
if K is the sectional curvature of the base manifold.

Proof Fix 0 ≤ k ≤ n and let w k+1 : s → w k+1 (s) be a vector field along the curve x k+1 : s → x k+1 (s). By definition,

∇ s f (-) k (w k+1 ) = ∇ s f (-) k (w k+1 ) + f (-) k (∇ s w k+1 ), ∇ s g (-) k (w k+1 ) = ∇ s g (-) k (w k+1 ) + g (-) k (∇ s w k+1 ).
Consider the path of gedesics s → γ k (s, •) such that for all s ∈ [0, 1], γ k (s, 0) = x k (s), γ k (s, 1) = x k+1 (s) and t → γ k (s, t) is a geodesic. We denote by w k+1 the vector field along the curve x k obtained by parallel transporting back the vector w k+1 (s) along the geodesic γ k (s, •) for all s ∈ [0, 1], i.e. w k+1 (s) = P 1,0 γ k (s,•) (w k+1 (s)). We have

∇ s f (-) k (w k+1 ) = ∇ s f k (w k+1 ) = ∇ s f k (w k+1 ) + f k ∇ s (w k+1 ) , (36)
and so we need to compute ∇ s (w k+1 ). Let V (s, t) := P 1,t γ k (s,•) (w k+1 ) so that ∇ s V (s, 1) = ∇ s w k+1 and ∇ s V (s, 0) = ∇ s (w k+1 ), then

∇ s V (s, 1) 1,0 = ∇ s V (s, 0) + 1 0 ∇ t ∇ s V (s, t) t,0 dt, = ∇ s V (s, 0) + 1 0 R(∂ t γ k t,0 , ∂ s γ k t,0 )V (s, t) t,0 dt,
since ∇ t V = 0, and where ∂ t γ k (s, t) t,0 = τ k (s). We get, since ∇R = 0,

(∇ s w k+1 ) = ∇ s (w k+1 )+R τ k , 1 0 ∂ s γ k t,0 dt (w k+1 ). (37)
To find an expression for ∂ s γ k t,0 , we consider the Jacobi field J(t) := ∂ s γ k (s, t) along the geodesic t → γ k (s, t). The vector field J verifies

J(0) = x k (s), J(1) = x k+1 (s), ∇ t J(0) = ∇ s τ k (s),
where the last equality results from the inversion ∇ t ∂ s γ k (s, 0) = ∇ s ∂ t γ k (s, 0) and ∂ t γ k (s, 0) = τ k (s). Applying Lemma 1 gives, for all k = 0, . . . , n -1,

∂ s γ k (s, t) t,0 = x k (s) T + a k (s, t) x k (s) N + t ∇ s τ k (s) T + b k (s, t)∇ s τ k (s) N .
with the coefficients

a k (s, t) =    cosh (|τ k (s)|t) , if K = -1, 1 if K = 0, cos (|τ k (s)|t) , if K = +1, b k (s, t) =    sinh (|τ k (s)|t) /|τ k (s)| if K = -1, 1 if K = 0, sin (|τ k (s))|t) /|τ k (s)| if K = +1.
Integrating this and injecting it in (37) gives

∇ s (w k+1 ) = (∇ s w k+1 ) + R (Y k , τ k ) (w k+1 ), (38)
where Y k is defined by

Y k = (x k ) T + b k (x k ) N + 1 2 ∇ s τ k T + K 1 -a k |τ k | 2 ∇ s τ k N ,
and injecting this in (36) finally gives,

∇ s f (-) k (w k+1 ) = ∇ s f k (w k+1 ) + f k (∇ s w k+1 ) + f k R (Y k , τ k ) (w k+1 ) = (∇ s f k ) (-) (w k+1 ) + f (-) k (∇ s w k+1 ) + f k R (Y k , τ k ) (w k+1 ) ,
which is what we wanted. The covariant derivative ∇ s g (-)

k (w k+1 ) can be computed in a similar way.

Appendix B

Proposition 6 (Discrete geodesic equations) A path s → α(s) = (x 0 (s), . . . , x n (s)) in M n+1 is a geodesic for metric G n if and only if its SRV representation s → x 0 (s), (q k (s)) k verifies the following differential equations

∇ s x 0 + 1 n R 0 + f (-) 0 (R 1 ) + . . . + f (-) 0 • • • • • f (-) n-2 (R n-1 ) = 0, ∇ 2 s q k + 1 n g (-) k R k+1 + f (-) k+1 (R k+2 ) + . . . + f (-) k+1 • • • • • f (-) n-2 (R n-1 ) = 0,
for all k = 0, . . . , n -1, with the notations (13) and

R k := R(q k , ∇ s q k )x k .
Proof We consider a variation (-δ, δ) a → α(a, •) = (x 0 (a, •), . . . , x n (a, •)) of this curve which coincides with α for a = 0, i.e. α(0, s) = α(s) for all s ∈ [0, 1], and which preserves the end points of α, i.e. α(a, 0) = α(0) and α(a, 1) = α(1) for all a ∈ (-δ, δ). The energy of this variation with respect to metric G n can be seen as a real function of the variable a and is given by

E n (a) = 1 2 1 0 |∂ s x 0 (a, s)| 2 + 1 n n-1 k=0 |∇ s q k (a, s)| 2 ds,
and its derivative (E n ) (a) with respect to a is

1 0 ∂ a ∂ s x 0 , ∂ s x 0 + 1 n n-1 k=0 ∇ a ∇ s q k , ∇ s q k ds = 1 0 ∂ s ∂ a x 0 , ∂ s x 0 + 1 n n-1 k=0 ∇ s ∇ a q k + R(∂ a x k , ∂ s x k )q k , ∇ s q k ds, = - 1 0 ∇ s (∂ s x 0 ) , ∂ a x 0 + 1 n n-1 k=0 ∇ 2 s q k , ∇ a q k + R(q k , ∇ s q k )∂ s x k , ∂ a x k ds,
where we integrate by parts to obtain the third line from the second. The goal is to express ∂ a x k in terms of ∂ a x 0 and ∇ a q , = 0, • • • , k. That way, the only elements that depend on a once we take a = 0 are (∂ a x 0 , ∇ a q 0 , • • • , ∇ a q n-1 ) which can be chosen independently to be whatever we want. Let us fix 0 ≤ k ≤ n -1 and s ∈ [0, 1] and consider the path of geodesics a → γ k (a, •) such that γ k (a, 0) = x k (a, s), γ k (a, 1) = x k+1 (a, s) and ∂ t γ k (a, 0) = τ k (a, s) = log x k (a,s) (x k+1 (a, s)). Then by definition, for each a ∈ [0, 1], t → J(a, t) := ∂ a γ k (a, t) is a Jacobi field along the geodesic t → γ k (a, t) of M , and so Lemma 1 gives

∂ a x k+1 = ∂ a x k T + a k ∂ a x k N + ∇ a τ k T + b k ∇ s τ k N , (39)
where ∂ a x k+1 denotes the parallel transport of ∂ a x k+1 from x k+1 (s) to x k (s) along the geodesic. Differentiation of

q k = √ n τ k /|τ k | gives ∇ s q k = √ n |τ k | -1/2 ∇ s τ k -1 2 ∇ s τ k T ,
and taking the tangential part on both sides yields

∇ s q k T = √ n |τ k | -1/2 1 2 ∇ s τ k T
, and so finally

∇ s τ k = |τ k | 1/2 / √ n ∇ s q k + ∇ s q k T = |q k |/n ∇ s q k + ∇ s q k T .
Injecting this in (39) and noticing that f k (w), z = w, f k (z) and g k (w), z = w, g k (z) for any pair of vectors w, z gives

∂ a x k+1 = f k (∂ a x k ) + 1 n g k (∇ a q k ), (40)
w k+1 , ∂ a x k+1 = f (-) k (w k+1 ), ∂ a x k + 1 n g (-) k (w k+1 ), ∇ a q k , (41)
for any tangent vector w k+1 ∈ T x k+1 M . From equation (41) we can deduce, for k = 1, . . . , n,

w k , ∂ a x k = f (-) 0 • • • • • f (-) k-1 (w k ), ∂ a x 0 + 1 n k-1 =0 g (-) • f (-) +1 • • • • • f (-) k-1 (w k ), ∇ a q . With the notation R k := R(q k , ∇ s q k )x k we get R k , ∂ a x k = f (-) 0 • • • • • f (-) k-1 (R k ), ∂ a x 0 + 1 n k-1 =0 g (-) • f (-) +1 • • • • • f (-) k-1 (R k ), ∇ a q ,
and we can then write the derivative of the energy (E n ) (0) for a = 0 in the following way

- 1 0 ∇ s x 0 + 1 n n-1 k=0 f (-) 0 • • • • • f (-) k-1 (R k ), ∂ a x 0 + 1 n 2 n-1 k=1 k-1 =0 g (-) • f (-) +1 • • • • • f (-) k+1 (R k ), ∇ a q + 1 n n-1 k=0 ∇ 2 s q k , ∇ a q k ds,
where in the first sum we use the notation convention

f 0 • • • • • f -1 := Id.
Noticing that the double sum can be rewritten

n-2 =0 n-1 k= +1 g (-) • f (-) +1 • • • • • f (-) k-1 (R k ), ∇ a q , we obtain for (E n ) (0) - 1 0 ∇ s x 0 + 1 n n-1 k=0 f (-) 0 • • • • • f (-) k-1 (R k ), ∂ a x 0 + 1 n n-1 k=0 ∇ 2 s q k + 1 n n-1 =k+1 g (-) k • f (-) k+1 • • • • • f (-) -1 (R ), ∇ a q k ds, (42)
where in the last sum we use the convention n-1 =n = 0. Since this quantity has to vanish for any choice of (∂ a x 0 (0, •), ∇ a q 0 (0, •), . . . , ∇ a q n-1 (0, •)), the geodesic equations for the discrete metric are

∇ s x 0 + 1 n n-1 k=0 f (-) 0 • • • • • f (-) k-1 (R k ) = 0, ∇ 2 s q k + 1 n n-1 =k+1 g (-) k • f (-) k+1 • • • • • f (-) -1 (R ) = 0,
for all k = 0, . . . , n -1, with the conventions

n-1 =n = 0 and f 0 • • • • • f -1 := Id. Remark 4 Let [0, 1] s → c(s, •) ∈ M be a C 1 path of smooth curves and [0, 1]
s → α(s) ∈ M n+1 the discretization of size n of c. We denote as usual by q := c t /|c t | 1/2 and (q k ) k their respective SRV representations. When n → ∞ and |τ k | → 0 while n|τ k | stays bounded for all 0 ≤ k ≤ n, the coefficients of the discrete geodesic equation [START_REF] Younes | Computable elastic distances between shapes[END_REF] for α converge to the coefficients of the continuous geodesic equation (7) for c, i.e.

∇ s x 0 (s) = -r 0 (s) + o(1), ∇ 2 s q k (s) = -|q k (s)|(r k (s) + r k (s) T ) + o(1),
for all s ∈ [0, 1] and k = 0, . . . , n -1, where r n-1 = 0 and for k = 1, . . . , n -2,

r k (s) := 1 n n-1 =k+1 P l n , k n c R(q, ∇ s q)c s (s, n ) → n→∞ r(s, k n ),
with the exception that the sum starts at = 0 for r 0 .

Proof This is due to three arguments : (1) at the limit,

f k (w) = w + o(1/n) and g k (w) = |q k |(w + w T ) + o(1/n), (2)
parallel transport along a piecewise geodesic curve uniformly converges to the parallel transport along the limit curve, and (3) the discrete curvature term R k (s) converges to the continuous curvature term R(q, ∇ s q)c s (s, k n ) for all k. Indeed, let ĉ be the unique piecewise geodesic curve of which α is the discretization, i.e. c k n = ĉ k n = x k for all k = 0, . . . , n and ĉ is a geodesic on each segment k n , k+1 n . Defining

r0 := 1 n R 0 + f (-) 0 (R 1 ) + . . . + f (-) 0 • • • • • f (-) n-2 (R n-1 ) rk := 1 n R k+1 + f (-) k+1 (R k+2 ) + . . . + f (-) k+1 • • • • • f (-) n-2 (R n-1 ) 1 ≤ k ≤ n -2, rn-1 := 0,
the geodesic equations can be written in terms of the vectors rk ∇ s x 0 (s) + r0 (s) = 0,

∇ 2 s q k (s) + g (-) k rk (s) = 0.
We can show that for any 0 ≤ k ≤ ≤ n -2 and any vector w ∈ T

x +1 M , f (-) k • • • • • f (-) (w) -P +1 n , k n c (w) ≤ j=k |a j -1| • f (-) j+1 • • • • • f (-) (w) + P +1 n , k n ĉ (w) -P +1 n , k n c (w) . Since |a j -1|/|τ k | 2 → 0 when n → ∞ and n|τ k | stays bounded,
we have for all 0 ≤ j ≤ n and n large enough |a j -1| ≤ 1 n 2 , and using the fact that parallel transport along a piecewise geodesic curve uniformly converges to the parallel transport along the limit curve, we get

|f (-) k • • • • • f (-) (w) -P +1 n , k n c (w)| → 0
when n → ∞. Now, denoting by R(s, t) := R(q, ∇ s q)c s (s, t)

the curvature term involved in the continuous geodesic equations, we have since

x k (s) = c s (s, k n ) and |R(X, Y )Z| ≤ |K| • (| Y, Z ||X| + | X, Z, ||Y |) ≤ 2|K| • |X| • |Y | • |Z| by Cauchy Schwarz, |R k -R( k n )| ≤ |R(q k -q( k n ), ∇ s q k )x k | + |R(q( k n ), ∇ s q k -∇ s q( k n ))x k | ≤ |q k -q( k n )| • |∇ s q k | • |x k | + |q( k n )| • |∇ s q k -∇ s q( k n )| • |x k |
Let us show that both summands of this upper bound tend to 0 when n → ∞.

|q k -q( k n )| = |nτ k | -1 2 nτ k -|c t ( k n )| -1 2 c t ( k n ) ≤ ||nτ k | -1 2 -|c t ( k n )| -1 2 | • |nτ k | + |c t ( k n )| -1 2 |nτ k -c t ( k n )| = |nτ k | -|c t ( k n )| |nτ k | 1 2 + |c t ( k n )| 1 2 • |nτ k | + |c t ( k n )| -1 2 |nτ k -c t ( k n )| ≤ |nτ k | |nτ k | 1 2 + |c t ( k n )| 1 2 + |c t ( k n )| -1 2 |nτ k -c t ( k n )|
and since the portion of c(s, •) on the segment

[ k n , k+1 n ] is close to a geodesic at the limit, |nτ k -c t ( k n )| → 0 when n → ∞, and so does |q k (s) -q( k n )|. Similarly, |∇ s q k -∇ s q( k n )| = |nτ k | -1/2 (n∇ s τ k -1 2 n∇ s τ k T ) -|c t | -1/2 (∇ s c t ( k n ) -1 2 ∇ s c t ( k n ) T ) ≤ ||nτ k | -1/2 -|c t ( k n )| -1/2 | • |n∇ s τ k | + |c t | -1/2 |n∇ s τ k -∇ s c t ( k n )|,
where once again s → α(s) = (x 0 (s), . . . , x n (s)) be a geodesic path in M n+1 . For all s ∈ [0, 1], the coordinates of its acceleration ∇ s α (s) can be iteratively computed in the following way

||nτ k | -1/2 -|c t ( k n )| -1/2
|n∇ s τ k -∇ s c t ( k n )| ≤ |n∇ s τ k -n c s ( k+1 n ) -c s ( k n ) | + |∇ t c s ( k n ) -n c s ( k+1 n ) -c s ( k n ) | ≤ n|1 -b -1 k | • |c s ( k+1 n ) -c s ( k n )| + 1 n |∇ t ∇ t c s | ∞ ≤ 1 n (|∇ t c s | ∞ + |∇ t ∇ t c s | ∞ ), since ∇ s τ k = (D τ α ) k = (x k+1 -x k ) T + b -1 k (x k+1 - x k ) N and b -1 k → 1.
∇ s x 0 = - 1 n R 0 + f (-) 0 (R 1 ) + . . . + f (-) 0 • • • • • f (-) n-2 (R n-1 ) , ∇ s x k+1 = ∇ s f k (x k ) + f k (∇ s x k ) + 1 n ∇ s g k (∇ s q k ) + 1 n g k (∇ 2 s q k ) + R(τ k , Y k )(x k+1 ),
for k = 0, . . . , n -1, where the R k 's are defined as in Proposition 7, the symbol • denotes the parallel transport from x k+1 (s) back to x k (s) along the geodesic linking them, the maps ∇ s f k and ∇ s g k are given by Lemma 2, Y k is given by Equation [START_REF] Tumpach | Quotient elastic metrics on the manifold of arc-length parameterized plane loops[END_REF] and

∇ s τ k = (D τ α ) k , ∇ s v k = 1 |τ k | ∇ s τ k -∇ s τ k T , ∇ s q k = n |τ k | ∇ s τ k - 1 2 ∇ s τ k T , ∇ 2 s q k = - 1 n g (-) k R k+1 + f (-) k+1 (R k+2 ) + . . . + f (-) k+1 • • • • • f (-) n-2 (R n-1 ) .
Proof For all s ∈ [0, 1], we initialize ∇ s x k (s) for k = 0 using the first geodesic equation in [START_REF] Younes | Computable elastic distances between shapes[END_REF]; the difficulty lies in deducing ∇ s x k+1 (s) from ∇ s x k (s). Just as we have previously obtained (40), we can obtain by replacing the derivatives with respect to a by derivatives with respect to s

x k+1 = x k T + a k x k N + ∇ s q k T + b k ∇ s τ k N , (43)
x k+1 = f k (x k ) + 1 n g k (∇ s q k ),
and by differentiating with respect to s

∇ s x k+1 = ∇ s f k (x k ) + f k (∇ s x k ) + 1 n ∇ s g k (∇ s q k ) + 1 n g k (∇ 2 s q k ). (44)
We have already computed (38) the covariant derivative of a vector field s → w k+1 (s) ∈ T x k (s) M and so we can write

∇ s x k+1 = ∇ s x k+1 + R(Y k , τ k ) x k+1 ,
where Y k is defined by Equation [START_REF] Tumpach | Quotient elastic metrics on the manifold of arc-length parameterized plane loops[END_REF]. Together with Equation (44), this gives the desired equation for ∇ s x k+1 . Finally, ∇ s τ k = (D τ α ) k results directly from (43), ∇ 2 s q k is deduced from the second geodesic equation and the remaining equations follow from simple computation.

Proposition 8 (Discrete Jacobi fields) Let [0, 1] s → α(s) = (x 0 (s), . . . , x n (s)) be a geodesic path in M n+1 , [0, 1] s → J(s) = (J 0 (s), . . . , J n (s)) a Jacobi field along α, and (-δ, δ) a → α(a, •) a corresponding family of geodesics, in the sense just described. Then J verifies the second order linear ODE ∇ 2 s J 0 = R(x 0 , J 0 )x 0 -

1 n ∇ a R 0 + f (-)
0 (∇ a R 1 ) + . . .

+ f (-) 0 • • • • • f (-) n-2 (∇ a R n-1 ) - 1 n n-2 k=0 k =0 f (-) 0 • • • • • ∇ a f (-) • • • • • f (-) k (R k+1 ), ∇ 2 s J k+1 = f k (∇ 2 s J k ) + 2∇ s f k (∇ s J k ) + ∇ 2 s f k (J k ) + 1 n g k (∇ 2 s ∇ a q k ) + 2 n ∇ s g k (∇ s ∇ a q k ) + 1 n ∇ 2 s g k (∇ a q k ) + 2R(τ k , Y k )(∇ s J k+1 ) + R(∇ s τ k , Y k )(J k+1 ) + R(τ k , ∇ s Y k )(J k+1 ) + R(τ k , Y k ) R(Y k , τ k )(J k+1 ) ,
for all 0 ≤ k ≤ n -1, where R k := R(q k , ∇ s q k )x k and the various covariant derivatives according to a can be expressed as functions of J and ∇ s J,

∇ a R k = R ∇ a q k , ∇ s q k x k + R q k , ∇ s ∇ a q k + R(J, x k )q k x k + R q k , ∇ s q k )∇ s J k , ∇ a q k = n |τ k | ∇ a τ k - 1 2 ∇ a τ k T , ∇ a τ k = (D τ J) k , ∇ a v k = 1 |τ k | ∇ a τ k -∇ a τ k T , ∇ s ∇ a q k = n g k -1 (∇ s J k+1 ) + R(Y k , τ k )(J k+1 ) -∇ s f k (J k ) -f k (∇ s J k ) + n ∇ s g k -1 J k+1 -f k (J k ) , ∇ 2 s ∇ a q k = - 1 n n-1 =k+1 g (-) k • f (-) k+1 • • • • • f (-) -1 (∇ a R ) + R(∇ s x k , J k )q k + R(x k , ∇ s J k )q k + 2R(x k , J k )∇ s q k - 1 n n-1 =k+1 -1 j=k g (-) k • • • • • ∇ a f (-) j • • • • • f (-) -1 (R ), ∇ s Y k = (∇ s x k ) T + b k (∇ s x k ) N + ∂ s b k (x k ) N + (1 -b k ) x k , ∇ s v k v k x k , v k ∇ s v k + 1 2 (∇ 2 s τ k ) T + K 1 -a k |τ k | 2 (∇ 2 s τ k ) N + ∂ s K 1 -a k |τ k | 2 (∇ s τ k ) N + 1 2 -K 1 -a k |τ k | 2 ( ∇ s τ k , ∇ s v k v k + ∇ s τ k , v k ∇ s v k ),
with the notation conventions f

∇ a f (-) k (w) = (∇ a f k ) (-) (w) + f k R(Z k , τ k )(w k+1 ) , ∇ a g (-) k (w) = (∇ a g k ) (-) (w) + g k R(Z k , τ k )(w k+1 ) , ∇ s g k -1 (w) = ∂ s |q k | -1 |q k |g k -1 (w) +|q k | -1 ∂ s (b -1 k ) w N + |q k | -1 1/2 -b -1 k w, ∇ s v k v k + w, v k ∇ s v k ,
and

Z k = J k T + b k J k N + 1 2 ∇ a τ k T + K 1 -a k |τ k | 2 ∇ a τ k N .
Proof For all a ∈ (-δ, δ), α(a, •) verifies the geodesic equations [START_REF] Younes | Computable elastic distances between shapes[END_REF]. Taking the covariant derivative of these equations according to a we obtain ∇ a ∇ s ∂ s x 0 (45)

+ 1 n n-1 k=0 ∇ a f (-) 0 • • • • • f (-) k-1 R(q k , ∇ s q k )∂ s x k = 0, ∇ a ∇ 2 s q k + 1 n n-1 =k+1 ∇ a g (-) k • f (-) k+1 • • • • (46) • f (-)
-1 R(q , ∇ s q )∂ s x = 0.

Since for a = 0, ∇ a ∇ s ∂ s x 0 = ∇ 2 s J 0 + R(J 0 , ∂ s x 0 )∂ s x 0 , we get

∇ 2 s J 0 = R(∂ s x 0 , J 0 )∂ s x 0 - 1 n n-1 k=0 ∇ a f (-) 0 • • • • • f (-) k-1 R(q k , ∇ s q k )∂ s x k ,
and the differentiation

∇ a f (-) 0 • • • • • f (-) k-1 (R k ) = f (-) 0 • • • • • f (-) k-1 (∇ a R k ) + k-1 =0 f (-) 0 • • • • • ∇ a f (-) • • • • • f (-) k-1 (R k )
gives the desired equation for ∇ 2 s J 0 . Now we will try to deduce ∇ 2 s J k+1 from (46). If J k+1 (s) denotes the parallel transport of the vector J k+1 (s) from x k+1 (s) back to x k (s) along the geodesic that links them, we know from (40) that

J k+1 = f k (J k ) + 1 n g k (∇ a q k ). (47)
We also know from (38) that

(∇ s J k+1 ) = ∇ s (J k+1 ) + R(τ k , Y k )(J k+1 ), (48)
and by iterating

(∇ 2 s J k+1 ) = ∇ s (∇ s J k+1 ) + R τ k , Y k (∇ s J k+1 ) = ∇ 2 s (J k+1 ) + ∇ s R(τ k , Y k )(J k+1 ) + R τ k , Y k (∇ s J k+1 )
Developping and injecting Equation (47) in the latter gives

(∇ 2 s J k+1 ) = ∇ 2 s f k (J k ) + 1 n ∇ 2 s g k (∇ a q k ) + R(∇ s τ k , Y k )(J k+1 ) + R(τ k , ∇ s Y k )(J k+1 ) + R(τ k , Y k )(R(Y k , τ k )(J k+1 )) + 2R τ k , Y k (∇ s J k+1 ) .
Developping the covariant derivatives ∇ 2 s f k (J k ) and ∇ 2 s g k (∇ a q k ) gives the desired formula. Now let us explicit the different terms involved in these differential equations. Since ∇R = 0 and ∇ a ∂ s x k = ∇ s ∂ a x k , we have

∇ a R k = R(∇ a q k , ∇ s q k )∂ s x k + R(q k , ∇ a ∇ s q k )∂ s x k + R(q k , ∇ s q k )∇ s J k = R ∇ a q k , ∇ s q k x k + R q k , ∇ s ∇ a q k + R(J, x k )q k x k + R q k , ∇ s q k )∇ s J k .
By taking the inverse of (47) we get

∇ a q k = ng -1 k J k+1 -f k (J k ) ,
and taking the derivative according to s on both sides and injecting Equation (48) gives

∇ s ∇ a q k = n g k -1 (∇ s J k+1 ) + R(Y k , τ k )(J k+1 ) -∇ s f k (J k ) -f k (∇ s J k ) + n ∇ s g k -1 J k+1 -f k (J k ) .
To obtain ∇ 2 s ∇ a q k , notice that

∇ 2 s ∇ a q k = ∇ s ∇ a ∇ s q k + ∇ s R(∂ s x k , J k )q k , = ∇ a ∇ 2 s q k + R(∂ s x k , J k )∇ s q k + ∇ s R(∂ s x k , J k )q k ,
and injecting Equation (46) with

∇ a g (-) k • f (-) k+1 • • • • • f (-) -1 (R ) = g (-) k • f (-) k+1 • • • • • f (-) -1 (∇ a R ) + -1 j=k g (-) k • • • • • ∇ a f (-) j • • • • • f (-) -1 (R ),
gives us the desired formula. ∇ s Y k results from simple differentiation, and differentiating the maps f with respect to a is completely analogous to the the computations of Lemma 3. Finally, the inverse of g k is given by g k -1 :

T x k M → T x k M , g k -1 : w → |q k | -1 b -1 k w + 1 2 -b -1 k w T ,
and since

∇ s (w T ) = (∇ s w) T + w, ∇ s v k v k + w, v k ∇ s v k ,
it is straightforward to verify that ∇ s g k -1 (w) = ∇ s g k -1 (w) -g k -1 (∇ s w)

gives

∇ s g k -1 (w) = ∂ s |q k | -1 |q k |g k -1 (w)+|q k | -1 ∂ s (b -1 k ) w N + |q k | -1 1/2 -b -1 k w, ∇ s v k v k + w, v k ∇ s v k .

Fig. 1

 1 Fig. 1 Examples of (suboptimal) matchings between shapes in R 3 . Correspondence between points is shown with dashed lines.

Fig. 2

 2 Fig. 2 Schematic illustration of geodesic shooting.

Fig. 3

 3 Fig. 3 Schematic representation of the shape bundle.

Fig. 4

 4 Fig. 4 Schematic illustration of the n th step of the optimal matching algorithm.

Fig. 5

 5 Fig. 5 Schematic representation of a path of piecewise geodesic curve associated to a pair (α, w).

Lemma 3

 3 k . Denoting by γ k (s) the geodesic of M linking x k (s) to x k+1 (s) for all s ∈ [0, 1] and 0 ≤ k ≤ n -1, we have the following result. The covariant derivatives of the functions f s are functions T x k+1 (s) M → T x k (s) M given by

Fig. 6

 6 Fig. 6 Illustration of the dynamic programming algorithm.

Fig. 7

 7 Fig. 7 Stability of the norm of the speed of a geodesic obtained by geodesic shooting as the number of points used to compute it increases.

Fig. 9

 9 Fig.9Horizontal geodesics and the corresponding optimal matching between curves in R 2 (first line) and H 2 (second line).

Fig. 10

 10 Fig. 10 Geodesics between hurricane tracks in S 2 before (top) and after (bottom) optimal matching.

Fig. 11

 11 Fig. 11 Plane trajectories between Paris and Caracas (left) and Fréchet mean curves of the two clusters given by agglomerative hierarchical clustering (right).

Lemma 3

 3 0)| , and for K = 1, the same formula with cosine and sine functions instead of hyperbolic cosine and sine. The covariant derivatives of the functions f s are functions T x k+1 (s) M → T x k (s) M given by

•Proposition 7 (

 7 Finally, we can see that|r 0 (s) -r 0 (s)| ≤ . . . • f (-) (R +1 ) -P +1 n ,0 c (R +1 )goes to 0 when n → ∞. We can show in a similar way that |g(-) k (r k ) -|q k |(r k + r k T )| → 0 when n → ∞. Discrete exponential map) Let [0, 1]

  | → 0 and |n∇ s τ k | is bounded. The last term can be bounded, for n large enough, by

https://ghrc.nsstc.nasa.gov/storms/.

http://iagos.sedoo.fr/.

Acknowledgments

This research was supported by Thales Air Systems and the french MoD DGA. MOZAIC/CARIBIC/IAGOS data were created with support from the European Commission, national agencies in Germany (BMBF), France (MESR), and the UK (NERC), and the IAGOS member institutions (http://www.iagos.org/partners). The participating airlines (Lufthansa, Air France, Austrian, China Airlines, Iberia, Cathay Pacific, Air Namibia, Sabena) supported IAGOS by carrying the measurement equipment free of charge since 1994. The data are available at http://www.iagos.fr thanks to additional support from AERIS.

Appendix A Lemma 1 Let γ : [0, 1] → M be a geodesic of a manifold M of constant sectional curvature K, and J a Jacobi field along γ. Then the parallel transport of J(t) along γ from γ(t) to γ(0) is given by

Proof As a Jacobi field along γ, J satisfies the wellknown equation (see e.g. [START_REF] Jost | Riemannian geometry and geometric analysis[END_REF])

If M is flat, we get ∇ 2 t J(t) = 0 and so J(t) = J(0) + t∇ t J(0). If not, we can decompose J in the sum J = J T +J N of two vector fields that parallel translate along γ, J T = J, v v with v = γ /|γ |, and J N = J -J T . Since ∇ 2 t J, γ = 0 and γ is parallel along γ, we get by integrating twice that J(t), γ (t) = ∇ t J(0), γ (0) t + J(0), γ (0) , J(t), v(t) = ∇ t J(0), v(0) t + J(0), v(0) .