SRVF Geodesic Computation

geodesic calculation for SRVF (curves) open and closed

moduleauthor:: J. Derek Tucker <jdtuck@sandia.gov>

geodesic.back_parallel_transport(u1, alpha, basis, T=100, k=5)[source]

backwards parallel translates q1 and q2 along manifold

Parameters:
  • u1 – numpy ndarray of shape (2,M) of M samples
  • alpha – numpy ndarray of shape (2,M) of M samples
  • basis – list numpy ndarray of shape (2,M) of M samples
  • T – Number of samples of curve (Default = 100)
  • k – number of samples along path (Default = 5)
Return type:

numpy ndarray

Return utilde:

translated vector

geodesic.calc_alphadot(alpha, basis, T=100, k=5)[source]

calculates derivative along the path alpha

Parameters:
  • alpha – numpy ndarray of shape (2,M) of M samples
  • basis – list of numpy ndarray of shape (2,M) of M samples
  • T – Number of samples of curve (Default = 100)
  • k – number of samples along path (Default = 5)
Return type:

numpy ndarray

Return alphadot:
 

derivative of alpha

geodesic.calculate_energy(alphadot, T=100, k=5)[source]

calculates energy along path

Parameters:
  • alphadot – numpy ndarray of shape (2,M) of M samples
  • T – Number of samples of curve (Default = 100)
  • k – number of samples along path (Default = 5)
Return type:

numpy scalar

Return E:

energy

geodesic.calculate_gradE(u, utilde, T=100, k=5)[source]

calculates gradient of energy along path

Parameters:
  • u – numpy ndarray of shape (2,M) of M samples
  • utilde – numpy ndarray of shape (2,M) of M samples
  • T – Number of samples of curve (Default = 100)
  • k – number of samples along path (Default = 5)
Return type:

numpy scalar

Return gradE:

gradient of energy

Return normgradE:
 

norm of gradient of energy

geodesic.cov_integral(alpha, alphadot, basis, T=100, k=5)[source]

Calculates covariance along path alpha

Parameters:
  • alpha – numpy ndarray of shape (2,M) of M samples (first curve)
  • alphadot – numpy ndarray of shape (2,M) of M samples
  • basis – list numpy ndarray of shape (2,M) of M samples
  • T – Number of samples of curve (Default = 100)
  • k – number of samples along path (Default = 5)
Return type:

numpy ndarray

Return u:

covariance

geodesic.find_basis_normal_path(alpha, k=5)[source]

computes orthonormalized basis vectors to the normal space at each of the k points (q-functions) of the path alpha

Parameters:
  • alpha – numpy ndarray of shape (2,M) of M samples (path)
  • k – number of samples along path (Default = 5)
Return type:

numpy ndarray

Return basis:

basis vectors along the path

geodesic.geod_dist_path_strt(beta, k=5)[source]

calculate geodisc distance for path straightening

Parameters:
  • beta – numpy ndarray of shape (2,M) of M samples
  • k – number of samples along path (Default = 5)
Return type:

numpy scalar

Return dist:

geodesic distance

geodesic.geod_sphere(beta1, beta2, k=5, scale=False, rotation=True, center=True)[source]

This function calculates the geodesics between open curves beta1 and beta2 with k steps along path

Parameters:
  • beta1 – numpy ndarray of shape (2,M) of M samples
  • beta2 – numpy ndarray of shape (2,M) of M samples
  • k – number of samples along path (Default = 5)
  • scale – include length (Default = False)
  • rotation – include rotation (Default = True)
  • center – center curves at origin (Default = True)
Return type:

numpy ndarray

Return dist:

geodesic distance

Return path:

geodesic path

Return O:

rotation matrix

geodesic.init_path_geod(beta1, beta2, T=100, k=5)[source]

Initializes a path in \(\cal{C}\). beta1, beta2 are already standardized curves. Creates a path from beta1 to beta2 in shape space, then projects to the closed shape manifold.

Parameters:
  • beta1 – numpy ndarray of shape (2,M) of M samples (first curve)
  • beta2 – numpy ndarray of shape (2,M) of M samples (end curve)
  • T – Number of samples of curve (Default = 100)
  • k – number of samples along path (Default = 5)
Return type:

numpy ndarray

Return alpha:

a path between two q-functions

Return beta:

a path between two curves

Return O:

rotation matrix

geodesic.init_path_rand(beta1, beta_mid, beta2, T=100, k=5)[source]

Initializes a path in \(\cal{C}\). beta1, beta_mid beta2 are already standardized curves. Creates a path from beta1 to beta_mid to beta2 in shape space, then projects to the closed shape manifold.

Parameters:
  • beta1 – numpy ndarray of shape (2,M) of M samples (first curve)
  • betamid – numpy ndarray of shape (2,M) of M samples (mid curve)
  • beta2 – numpy ndarray of shape (2,M) of M samples (end curve)
  • T – Number of samples of curve (Default = 100)
  • k – number of samples along path (Default = 5)
Return type:

numpy ndarray

Return alpha:

a path between two q-functions

Return beta:

a path between two curves

Return O:

rotation matrix

geodesic.path_straightening(beta1, beta2, betamid, init='rand', T=100, k=5)[source]

Perform path straightening to find geodesic between two shapes in either the space of closed curves or the space of affine standardized curves. This algorithm follows the steps outlined in section 4.6 of the manuscript.

Parameters:
  • beta1 – numpy ndarray of shape (2,M) of M samples (first curve)
  • beta2 – numpy ndarray of shape (2,M) of M samples (end curve)
  • betamid – numpy ndarray of shape (2,M) of M samples (mid curve Default = NULL, only needed for init “rand”)
  • init – initialize path geodesic or random (Default = “rand”)
  • T – Number of samples of curve (Default = 100)
  • k – number of samples along path (Default = 5)
Return type:

numpy ndarray

Return dist:

geodesic distance

Return path:

geodesic path

Return pathsqnc:
 

geodesic path sequence

Return E:

energy

geodesic.update_path(alpha, beta, gradE, delta, T=100, k=5)[source]

Update the path along the direction -gradE

Parameters:
  • alpha – numpy ndarray of shape (2,M) of M samples
  • beta – numpy ndarray of shape (2,M) of M samples
  • gradE – numpy ndarray of shape (2,M) of M samples
  • delta – gradient paramenter
  • T – Number of samples of curve (Default = 100)
  • k – number of samples along path (Default = 5)
Return type:

numpy scalar

Return alpha:

updated path of srvfs

Return beta:

updated path of curves