class_docstr: Elastic metric defined by a family of second order Sobolev metrics.
  
  Each individual discrete surface is represented by a 2D-array of shape
  `[n_vertices, 3]`. See [HSKCB2022]_ for details.
  
  The parameters a0, a1, b1, c1, d1, a2 (detailed below) are non-negative weighting
  coefficients for the different terms in the metric.
  
  Parameters
  ----------
  space : DiscreteSurfaces
      Instantiated DiscreteSurfaces manifold.
  a0 : float
      First order parameter.
      Default: 1.
  a1 : float
      Stretching parameter.
      Default: 1.
  b1 : float
      Shearing parameter.
      Default: 1.
  c1 : float
      Bending parameter.
      Default: 1.
  d1 : float
      Additonal first order parameter.
      Default: 1.
  a2 : float
      Second order parameter.
      Default: 1.
  
  References
  ----------
  .. [HSKCB2022] "Elastic shape analysis of surfaces with second-order
      Sobolev metrics: a comprehensive numerical framework".
      arXiv:2204.04238 [cs.CV], 25 Sep 2022
class_docstr_tok: ["Elastic","metric","defined","by","a","family","of","second","order","Sobolev","metrics",".","Each","individual","discrete","surface","is","represented","by","a","2D-array","of","shape","`","[","n_vertices",",","3","]","`",".","See","[","HSKCB2022","]","_","for","details",".","The","parameters","a0",",","a1",",","b1",",","c1",",","d1",",","a2","(","detailed","below",")","are","non-negative","weighting","coefficients","for","the","different","terms","in","the","metric",".","Parameters","--","--","--","--","--","space",":","DiscreteSurfaces","Instantiated","DiscreteSurfaces","manifold",".","a0",":","float","First","order","parameter",".","Default",":","1.","a1",":","float","Stretching","parameter",".","Default",":","1.","b1",":","float","Shearing","parameter",".","Default",":","1.","c1",":","float","Bending","parameter",".","Default",":","1.","d1",":","float","Additonal","first","order","parameter",".","Default",":","1.","a2",":","float","Second","order","parameter",".","Default",":","1",".","References","--","--","--","--","--","..","[","HSKCB2022","]","``","Elastic","shape","analysis","of","surfaces","with","second-order","Sobolev","metrics",":","a","comprehensive","numerical","framework","''",".","arXiv:2204.04238","[","cs.CV","]",",","25","Sep","2022"]
docstr: Compute d1 term of order 1 within the inner-product.
  
  Denote h and k the tangent vectors a and b respectively.
  Denote q the base point, i.e. the surface.
  
  The equation of the inner-product is:
  :math:`\int_M (G_{a_0} + G_{a_1} + G_{b_1} + G_{c_1} + G_{d_1} + G_{a_2})vol_q`.
  
  This method computes :math:`G_{d_1} = d_1.g_q^{-1} <dh_0, dk_0>`,
  with notations taken from [HSKCB2022]_.
  
  Parameters
  ----------
  one_forms_a : array-like, shape=[n_points, n_faces, 2, 3]
      One forms at point a corresponding to tangent vec a.
  one_forms_b : array-like, shape=[n_points, n_faces, 2, 3]
      One forms at point b corresponding to tangent vec b.
  one_forms_bp : array-like, shape=[n_faces, 2, 3]
      One forms at base point.
  areas_bp : array-like, shape=[n_faces,]
      Areas of the faces of the surface given by the base point.
  inv_surface_metrics_bp : array-like, shape=[n_faces, 2, 2]
      Inverses of the surface metric matrices at each face.
  
  Returns
  -------
  _ : array-like, shape=[...]
      Term of order 0, and coefficient d1, of the inner-product.
  
  References
  ----------
  .. [HSKCB2022] "Elastic shape analysis of surfaces with second-order
      Sobolev metrics: a comprehensive numerical framework".
      arXiv:2204.04238 [cs.CV], 25 Sep 2022.
docstr_tok: ["Compute","d1","term","of","order","1","within","the","inner-product",".","Denote","h","and","k","the","tangent","vectors","a","and","b","respectively",".","Denote","q","the","base","point",",","i.e",".","the","surface",".","The","equation","of","the","inner-product","is",":",":","math",":","`","\\int_M","(","G_","{","a_0","}","+","G_","{","a_1","}","+","G_","{","b_1","}","+","G_","{","c_1","}","+","G_","{","d_1","}","+","G_","{","a_2","}",")","vol_q","`",".","This","method","computes",":","math",":","`","G_","{","d_1","}","=","d_1.g_q^","{","-1","}","<","dh_0",",","dk_0",">","`",",","with","notations","taken","from","[","HSKCB2022","]","_.","Parameters","--","--","--","--","--","one_forms_a",":","array-like",",","shape=","[","n_points",",","n_faces",",","2",",","3","]","One","forms","at","point","a","corresponding","to","tangent","vec","a.","one_forms_b",":","array-like",",","shape=","[","n_points",",","n_faces",",","2",",","3","]","One","forms","at","point","b","corresponding","to","tangent","vec","b.","one_forms_bp",":","array-like",",","shape=","[","n_faces",",","2",",","3","]","One","forms","at","base","point",".","areas_bp",":","array-like",",","shape=","[","n_faces",",","]","Areas","of","the","faces","of","the","surface","given","by","the","base","point",".","inv_surface_metrics_bp",":","array-like",",","shape=","[","n_faces",",","2",",","2","]","Inverses","of","the","surface","metric","matrices","at","each","face",".","Returns","--","--","--","-","_",":","array-like",",","shape=","[","...","]","Term","of","order","0",",","and","coefficient","d1",",","of","the","inner-product",".","References","--","--","--","--","--","..","[","HSKCB2022","]","``","Elastic","shape","analysis","of","surfaces","with","second-order","Sobolev","metrics",":","a","comprehensive","numerical","framework","''",".","arXiv:2204.04238","[","cs.CV","]",",","25","Sep","2022","."]
code: def _inner_product_d1(
      self,
      one_forms_a,
      one_forms_b,
      one_forms_bp,
      areas_bp,
      inv_surface_metrics_bp,
  ):
      r"""Compute d1 term of order 1 within the inner-product.
  
      Denote h and k the tangent vectors a and b respectively.
      Denote q the base point, i.e. the surface.
  
      The equation of the inner-product is:
      :math:`\int_M (G_{a_0} + G_{a_1} + G_{b_1} + G_{c_1} + G_{d_1} + G_{a_2})vol_q`.
  
      This method computes :math:`G_{d_1} = d_1.g_q^{-1} <dh_0, dk_0>`,
      with notations taken from [HSKCB2022]_.
  
      Parameters
      ----------
      one_forms_a : array-like, shape=[n_points, n_faces, 2, 3]
          One forms at point a corresponding to tangent vec a.
      one_forms_b : array-like, shape=[n_points, n_faces, 2, 3]
          One forms at point b corresponding to tangent vec b.
      one_forms_bp : array-like, shape=[n_faces, 2, 3]
          One forms at base point.
      areas_bp : array-like, shape=[n_faces,]
          Areas of the faces of the surface given by the base point.
      inv_surface_metrics_bp : array-like, shape=[n_faces, 2, 2]
          Inverses of the surface metric matrices at each face.
  
      Returns
      -------
      _ : array-like, shape=[...]
          Term of order 0, and coefficient d1, of the inner-product.
  
      References
      ----------
      .. [HSKCB2022] "Elastic shape analysis of surfaces with second-order
          Sobolev metrics: a comprehensive numerical framework".
          arXiv:2204.04238 [cs.CV], 25 Sep 2022.
      """
      one_forms_bp_t = gs.transpose(one_forms_bp, (0, 2, 1))
  
      one_forms_a_t = gs.transpose(one_forms_a, (0, 1, 3, 2))
      xa = one_forms_a_t - one_forms_bp_t
  
      xa_0 = gs.matmul(
          gs.matmul(one_forms_bp_t, inv_surface_metrics_bp),
          gs.matmul(gs.transpose(xa, (0, 1, 3, 2)), one_forms_bp_t)
          - gs.matmul(one_forms_bp, xa),
      )
  
      one_forms_b_t = gs.transpose(one_forms_b, (0, 1, 3, 2))
      xb = one_forms_b_t - one_forms_bp_t
      xb_0 = gs.matmul(
          gs.matmul(one_forms_bp_t, inv_surface_metrics_bp),
          gs.matmul(gs.transpose(xb, (0, 1, 3, 2)), one_forms_bp_t)
          - gs.matmul(one_forms_bp, xb),
      )
  
      return self.d1 * gs.sum(
          gs.einsum(
              "...bii->...b",
              gs.matmul(
                  xa_0,
                  gs.matmul(
                      inv_surface_metrics_bp,
                      gs.transpose(xb_0, axes=(0, 1, 3, 2)),
                  ),
              ),
          )
          * areas_bp
      )
  
imports: import math
  import geomstats.backend
  from geomstats.geometry.euclidean import Euclidean
  from geomstats.geometry.manifold import Manifold
  from geomstats.geometry.riemannian_metric import RiemannianMetric
  from geomstats.numerics.optimizers import ScipyMinimize
label_desc: Use image node_id 6 for calling the ElasticMetric obj's underlying member method code with example usage: obj._inner_product_d1(one_forms_a, one_forms_b, one_forms_bp, areas_bp, inv_surface_metrics_bp) and returns: unknown