class_docstr: Class for the Kendall pre-shape space bundle.
class_docstr_tok: ["Class","for","the","Kendall","pre-shape","space","bundle","."]
docstr: Compute iterated derivatives of the integrability tensor A.
  
  The iterated horizontal covariant derivative
  :math:`\nabla_X (A_Y A_X Y)` (where :math:`X` and :math:`Y` are
  horizontal vector fields) is a key ingredient in the computation of
  the covariant derivative of the directional curvature in a submersion.
  
  The components :math:`\nabla_X (A_Y A_X Y)`, :math:`A_X A_Y A_X Y`,
  :math:`\nabla_X (A_X Y)`,  and intermediate computations
  :math:`A_Y A_X Y` and :math:`A_X Y` are computed here for the
  Kendall shape space in the special case of quotient-parallel vector
  fields :math:`X, Y` extending the values horizontal_vec_x and
  horizontal_vec_y by parallel transport in a neighborhood.
  Such vector fields verify :math:`\nabla_X^X = A_X X` and
  :math:`\nabla_X^Y = A_X Y`.
  
  Parameters
  ----------
  horizontal_vec_x : array-like, shape=[..., k_landmarks, m_ambient]
      Tangent vector at `base_point`.
  horizontal_vec_y : array-like, shape=[..., k_landmarks, m_ambient]
      Tangent vector at `base_point`.
  base_point : array-like, shape=[..., k_landmarks, m_ambient]
      Point of the total space.
  
  Returns
  -------
  nabla_x_a_y_a_x_y : array-like, shape=[..., k_landmarks, m_ambient]
      Tangent vector at `base_point`, result of
      :math:`\nabla_X^S (A_Y A_X Y)` with
      `X = horizontal_vec_x` and `Y = horizontal_vec_y`.
  a_x_a_y_a_x_y : array-like, shape=[..., k_landmarks, m_ambient]
      Tangent vector at `base_point`, result of
      :math:`A_X A_Y A_X Y` with
      `X = horizontal_vec_x` and `Y = horizontal_vec_y`.
  nabla_x_a_x_y : array-like, shape=[..., k_landmarks, m_ambient]
      Tangent vector at `base_point`, result of
      :math:`\nabla_X^S (A_X Y)` with
      `X = horizontal_vec_x` and `Y = horizontal_vec_y`.
  a_y_a_x_y : array-like, shape=[..., k_landmarks, m_ambient]
      Tangent vector at `base_point`, result of :math:`A_Y A_X Y` with
      `X = horizontal_vec_x` and `Y = horizontal_vec_y`.
  a_x_y : array-like, shape=[..., k_landmarks, m_ambient]
      Tangent vector at `base_point`, result of :math:`A_X Y` with
      `X = horizontal_vec_x` and `Y = horizontal_vec_y`.
  
  References
  ----------
  .. [Pennec] Pennec, Xavier. Computing the curvature and its gradient
      in Kendall shape spaces. Unpublished.
docstr_tok: ["Compute","iterated","derivatives","of","the","integrability","tensor","A",".","The","iterated","horizontal","covariant","derivative",":","math",":","`","\\nabla_X","(","A_Y","A_X","Y",")","`","(","where",":","math",":","`","X","`","and",":","math",":","`","Y","`","are","horizontal","vector","fields",")","is","a","key","ingredient","in","the","computation","of","the","covariant","derivative","of","the","directional","curvature","in","a","submersion",".","The","components",":","math",":","`","\\nabla_X","(","A_Y","A_X","Y",")","`",",",":","math",":","`","A_X","A_Y","A_X","Y","`",",",":","math",":","`","\\nabla_X","(","A_X","Y",")","`",",","and","intermediate","computations",":","math",":","`","A_Y","A_X","Y","`","and",":","math",":","`","A_X","Y","`","are","computed","here","for","the","Kendall","shape","space","in","the","special","case","of","quotient-parallel","vector","fields",":","math",":","`","X",",","Y","`","extending","the","values","horizontal_vec_x","and","horizontal_vec_y","by","parallel","transport","in","a","neighborhood",".","Such","vector","fields","verify",":","math",":","`","\\nabla_X^X","=","A_X","X","`","and",":","math",":","`","\\nabla_X^Y","=","A_X","Y","`",".","Parameters","--","--","--","--","--","horizontal_vec_x",":","array-like",",","shape=","[","...",",","k_landmarks",",","m_ambient","]","Tangent","vector","at","`","base_point","`",".","horizontal_vec_y",":","array-like",",","shape=","[","...",",","k_landmarks",",","m_ambient","]","Tangent","vector","at","`","base_point","`",".","base_point",":","array-like",",","shape=","[","...",",","k_landmarks",",","m_ambient","]","Point","of","the","total","space",".","Returns","--","--","--","-","nabla_x_a_y_a_x_y",":","array-like",",","shape=","[","...",",","k_landmarks",",","m_ambient","]","Tangent","vector","at","`","base_point","`",",","result","of",":","math",":","`","\\nabla_X^S","(","A_Y","A_X","Y",")","`","with","`","X","=","horizontal_vec_x","`","and","`","Y","=","horizontal_vec_y","`",".","a_x_a_y_a_x_y",":","array-like",",","shape=","[","...",",","k_landmarks",",","m_ambient","]","Tangent","vector","at","`","base_point","`",",","result","of",":","math",":","`","A_X","A_Y","A_X","Y","`","with","`","X","=","horizontal_vec_x","`","and","`","Y","=","horizontal_vec_y","`",".","nabla_x_a_x_y",":","array-like",",","shape=","[","...",",","k_landmarks",",","m_ambient","]","Tangent","vector","at","`","base_point","`",",","result","of",":","math",":","`","\\nabla_X^S","(","A_X","Y",")","`","with","`","X","=","horizontal_vec_x","`","and","`","Y","=","horizontal_vec_y","`",".","a_y_a_x_y",":","array-like",",","shape=","[","...",",","k_landmarks",",","m_ambient","]","Tangent","vector","at","`","base_point","`",",","result","of",":","math",":","`","A_Y","A_X","Y","`","with","`","X","=","horizontal_vec_x","`","and","`","Y","=","horizontal_vec_y","`",".","a_x_y",":","array-like",",","shape=","[","...",",","k_landmarks",",","m_ambient","]","Tangent","vector","at","`","base_point","`",",","result","of",":","math",":","`","A_X","Y","`","with","`","X","=","horizontal_vec_x","`","and","`","Y","=","horizontal_vec_y","`",".","References","--","--","--","--","--","..","[","Pennec","]","Pennec",",","Xavier",".","Computing","the","curvature","and","its","gradient","in","Kendall","shape","spaces",".","Unpublished","."]
code: def iterated_integrability_tensor_derivative_parallel(
      self, horizontal_vec_x, horizontal_vec_y, base_point
  ):
      r"""Compute iterated derivatives of the integrability tensor A.
  
      The iterated horizontal covariant derivative
      :math:`\nabla_X (A_Y A_X Y)` (where :math:`X` and :math:`Y` are
      horizontal vector fields) is a key ingredient in the computation of
      the covariant derivative of the directional curvature in a submersion.
  
      The components :math:`\nabla_X (A_Y A_X Y)`, :math:`A_X A_Y A_X Y`,
      :math:`\nabla_X (A_X Y)`,  and intermediate computations
      :math:`A_Y A_X Y` and :math:`A_X Y` are computed here for the
      Kendall shape space in the special case of quotient-parallel vector
      fields :math:`X, Y` extending the values horizontal_vec_x and
      horizontal_vec_y by parallel transport in a neighborhood.
      Such vector fields verify :math:`\nabla_X^X = A_X X` and
      :math:`\nabla_X^Y = A_X Y`.
  
      Parameters
      ----------
      horizontal_vec_x : array-like, shape=[..., k_landmarks, m_ambient]
          Tangent vector at `base_point`.
      horizontal_vec_y : array-like, shape=[..., k_landmarks, m_ambient]
          Tangent vector at `base_point`.
      base_point : array-like, shape=[..., k_landmarks, m_ambient]
          Point of the total space.
  
      Returns
      -------
      nabla_x_a_y_a_x_y : array-like, shape=[..., k_landmarks, m_ambient]
          Tangent vector at `base_point`, result of
          :math:`\nabla_X^S (A_Y A_X Y)` with
          `X = horizontal_vec_x` and `Y = horizontal_vec_y`.
      a_x_a_y_a_x_y : array-like, shape=[..., k_landmarks, m_ambient]
          Tangent vector at `base_point`, result of
          :math:`A_X A_Y A_X Y` with
          `X = horizontal_vec_x` and `Y = horizontal_vec_y`.
      nabla_x_a_x_y : array-like, shape=[..., k_landmarks, m_ambient]
          Tangent vector at `base_point`, result of
          :math:`\nabla_X^S (A_X Y)` with
          `X = horizontal_vec_x` and `Y = horizontal_vec_y`.
      a_y_a_x_y : array-like, shape=[..., k_landmarks, m_ambient]
          Tangent vector at `base_point`, result of :math:`A_Y A_X Y` with
          `X = horizontal_vec_x` and `Y = horizontal_vec_y`.
      a_x_y : array-like, shape=[..., k_landmarks, m_ambient]
          Tangent vector at `base_point`, result of :math:`A_X Y` with
          `X = horizontal_vec_x` and `Y = horizontal_vec_y`.
  
      References
      ----------
      .. [Pennec] Pennec, Xavier. Computing the curvature and its gradient
          in Kendall shape spaces. Unpublished.
      """
      if not gs.all(self.total_space.is_centered(base_point)):
          raise ValueError(
              "The base_point does not belong to the pre-shape space"
          )
      if not gs.all(self.is_horizontal(horizontal_vec_x, base_point)):
          raise ValueError("Tangent vector x is not horizontal")
      if not gs.all(self.is_horizontal(horizontal_vec_y, base_point)):
          raise ValueError("Tangent vector y is not horizontal")
  
      p_top = Matrices.transpose(base_point)
      p_top_p = gs.matmul(p_top, base_point)
  
      def sylv_p(mat_b):
          """Solves Sylvester equation for vertical component."""
          return gs.linalg.solve_sylvester(
              p_top_p, p_top_p, mat_b - Matrices.transpose(mat_b)
          )
  
      y_top = Matrices.transpose(horizontal_vec_y)
      x_top = Matrices.transpose(horizontal_vec_x)
      x_y_top = gs.matmul(y_top, horizontal_vec_x)
      omega_xy = sylv_p(x_y_top)
      vertical_vec_v = gs.matmul(base_point, omega_xy)
      omega_xy_x = gs.matmul(horizontal_vec_x, omega_xy)
      omega_xy_y = gs.matmul(horizontal_vec_y, omega_xy)
  
      v_top = Matrices.transpose(vertical_vec_v)
      x_v_top = gs.matmul(v_top, horizontal_vec_x)
      omega_xv = sylv_p(x_v_top)
      omega_xv_p = gs.matmul(base_point, omega_xv)
  
      y_v_top = gs.matmul(v_top, horizontal_vec_y)
      omega_yv = sylv_p(y_v_top)
      omega_yv_p = gs.matmul(base_point, omega_yv)
  
      nabla_x_v = 3.0 * omega_xv_p + omega_xy_x
      a_y_a_x_y = omega_yv_p + omega_xy_y
      tmp_mat = gs.matmul(x_top, a_y_a_x_y)
      a_x_a_y_a_x_y = -gs.matmul(base_point, sylv_p(tmp_mat))
  
      omega_xv_y = gs.matmul(horizontal_vec_y, omega_xv)
      omega_yv_x = gs.matmul(horizontal_vec_x, omega_yv)
      omega_xy_v = gs.matmul(vertical_vec_v, omega_xy)
      norms = Matrices.frobenius_product(vertical_vec_v, vertical_vec_v)
      sq_norm_v_p = gs.einsum("...,...ij->...ij", norms, base_point)
  
      tmp_mat = gs.matmul(
          p_top, 3.0 * omega_xv_y + 2.0 * omega_yv_x
      ) + gs.matmul(y_top, omega_xy_x)
  
      nabla_x_a_y_v = (
          3.0 * omega_xv_y
          + omega_yv_x
          + omega_xy_v
          - gs.matmul(base_point, sylv_p(tmp_mat))
          + sq_norm_v_p
      )
  
      return (
          nabla_x_a_y_v,
          a_x_a_y_a_x_y,
          nabla_x_v,
          a_y_a_x_y,
          vertical_vec_v,
      )
  
imports: import geomstats.backend
  from geomstats.geometry.base import LevelSet
  from geomstats.geometry.fiber_bundle import FiberBundle
  from geomstats.geometry.hypersphere import Hypersphere
  from geomstats.geometry.matrices import Matrices
  from geomstats.geometry.quotient_metric import QuotientMetric
  from geomstats.geometry.riemannian_metric import RiemannianMetric
  from geomstats.integrator import integrate
  from geomstats.vectorization import get_batch_shape, repeat_out
label_desc: Use image node_id 7 for calling the PreShapeSpaceBundle obj's underlying member method code with example usage: obj.iterated_integrability_tensor_derivative_parallel(horizontal_vec_x, horizontal_vec_y, base_point) and returns: nabla_x_a_y_v,  a_x_a_y_a_x_y,  nabla_x_v,  a_y_a_x_y,  vertical_vec_v, gs