class_docstr: Space of parameterized discrete surfaces.
  
  Each surface is sampled with fixed `n_vertices` vertices and `n_faces`
  faces in :math:`\mathbb{R}^3`.
  
  Each individual surface is represented by a 2d-array of shape
  `[n_vertices, 3]`. This space corresponds to the space of immersions
  defined below, i.e. the
  space of smooth functions from a template to manifold :math:`M`
  into :math:`\mathbb{R}^3`, with non-vanishing Jacobian.
  
  .. math::
      Imm(M,\mathbb{R}^3)=\{ f \in C^{\infty}(M, \mathbb{R}^3)
      \|Df(x)\|\neq 0 \forall x \in M \}.
  
  Parameters
  ----------
  faces : integer array-like, shape=[n_faces, 3]
      Triangulation of the surface.
      Each face is given by 3 indices that indicate its vertices.
class_docstr_tok: ["Space","of","parameterized","discrete","surfaces",".","Each","surface","is","sampled","with","fixed","`","n_vertices","`","vertices","and","`","n_faces","`","faces","in",":","math",":","`","\\mathbb","{","R","}","^3","`",".","Each","individual","surface","is","represented","by","a","2d-array","of","shape","`","[","n_vertices",",","3","]","`",".","This","space","corresponds","to","the","space","of","immersions","defined","below",",","i.e",".","the","space","of","smooth","functions","from","a","template","to","manifold",":","math",":","`","M","`","into",":","math",":","`","\\mathbb","{","R","}","^3","`",",","with","non-vanishing","Jacobian",".","..","math",":",":","Imm","(","M",",","\\mathbb","{","R","}","^3",")","=\\","{","f","\\in","C^","{","\\infty","}","(","M",",","\\mathbb","{","R","}","^3",")","\\|Df","(","x",")","\\|\\neq","0","\\forall","x","\\in","M","\\","}",".","Parameters","--","--","--","--","--","faces",":","integer","array-like",",","shape=","[","n_faces",",","3","]","Triangulation","of","the","surface",".","Each","face","is","given","by","3","indices","that","indicate","its","vertices","."]
docstr: Compute the mesh Laplacian operator of a triangulated surface.
  
  Denoting q the surface, i.e. the point in the DiscreteSurfaces manifold,
  the laplacian at :math:`q` is defined as the operator:
  :math:`\Delta_q = - Tr(g_q^{-1} \nabla^2)`
  where :math:`g_q` is the surface metric matrix of :math:`q`.
  
  Parameters
  ----------
  point :  array-like, shape=[n_vertices, 3]
      Surface, as the 3D coordinates of the vertices of its triangulation.
  
  Returns
  -------
  _laplacian : callable
      Function that evaluates the mesh Laplacian operator at a
      tangent vector field to the surface.
docstr_tok: ["Compute","the","mesh","Laplacian","operator","of","a","triangulated","surface",".","Denoting","q","the","surface",",","i.e",".","the","point","in","the","DiscreteSurfaces","manifold",",","the","laplacian","at",":","math",":","`","q","`","is","defined","as","the","operator",":",":","math",":","`","\\Delta_q","=","-","Tr","(","g_q^","{","-1","}","\\nabla^2",")","`","where",":","math",":","`","g_q","`","is","the","surface","metric","matrix","of",":","math",":","`","q","`",".","Parameters","--","--","--","--","--","point",":","array-like",",","shape=","[","n_vertices",",","3","]","Surface",",","as","the","3D","coordinates","of","the","vertices","of","its","triangulation",".","Returns","--","--","--","-","_laplacian",":","callable","Function","that","evaluates","the","mesh","Laplacian","operator","at","a","tangent","vector","field","to","the","surface","."]
code: def laplacian(self, point):
      r"""Compute the mesh Laplacian operator of a triangulated surface.
  
      Denoting q the surface, i.e. the point in the DiscreteSurfaces manifold,
      the laplacian at :math:`q` is defined as the operator:
      :math:`\Delta_q = - Tr(g_q^{-1} \nabla^2)`
      where :math:`g_q` is the surface metric matrix of :math:`q`.
  
      Parameters
      ----------
      point :  array-like, shape=[n_vertices, 3]
          Surface, as the 3D coordinates of the vertices of its triangulation.
  
      Returns
      -------
      _laplacian : callable
          Function that evaluates the mesh Laplacian operator at a
          tangent vector field to the surface.
      """
      n_vertices, n_faces = point.shape[-2], self.faces.shape[0]
      vertex_0, vertex_1, vertex_2 = self._vertices(point)
      len_edge_12 = gs.linalg.norm((vertex_1 - vertex_2), axis=-1)
      len_edge_02 = gs.linalg.norm((vertex_0 - vertex_2), axis=-1)
      len_edge_01 = gs.linalg.norm((vertex_0 - vertex_1), axis=-1)
  
      half_perimeter = 0.5 * (len_edge_12 + len_edge_02 + len_edge_01)
      area = gs.sqrt(
          (
              half_perimeter
              * (half_perimeter - len_edge_12)
              * (half_perimeter - len_edge_02)
              * (half_perimeter - len_edge_01)
          ).clip(min=1e-6)
      )
      sq_len_edge_12, sq_len_edge_02, sq_len_edge_01 = (
          len_edge_12 * len_edge_12,
          len_edge_02 * len_edge_02,
          len_edge_01 * len_edge_01,
      )
      cot_12 = (sq_len_edge_02 + sq_len_edge_01 - sq_len_edge_12) / area
      cot_02 = (sq_len_edge_12 + sq_len_edge_01 - sq_len_edge_02) / area
      cot_01 = (sq_len_edge_12 + sq_len_edge_02 - sq_len_edge_01) / area
      cot = gs.stack([cot_12, cot_02, cot_01], axis=1)
      cot /= 2.0
      id_vertices_120 = self.faces[:, [1, 2, 0]]
      id_vertices_201 = self.faces[:, [2, 0, 1]]
      id_vertices = gs.reshape(
          gs.stack([id_vertices_120, id_vertices_201], axis=0),
          (2, n_faces * 3),
      )
  
      def _laplacian(tangent_vec):
          """Evaluate the mesh Laplacian operator.
  
          The operator is evaluated at a tangent vector at point to the
          manifold of DiscreteSurfaces. In other words, the operator is
          evaluated at a vector field defined on the surface point.
  
          Parameters
          ----------
          tangent_vec : array-like, shape=[..., n_vertices, 3]
              Tangent vector to the manifold at the base point that is the
              triangulated surface. This tangent vector is a vector field
              on the triangulated surface.
  
          Returns
          -------
          laplacian_at_tangent_vec: array-like, shape=[..., n_vertices, 3]
              Mesh Laplacian operator of the triangulated surface applied
              to one its tangent vector tangent_vec.
          """
          to_squeeze = False
          if tangent_vec.ndim == 2:
              tangent_vec = gs.expand_dims(tangent_vec, axis=0)
              to_squeeze = True
          n_tangent_vecs = len(tangent_vec)
          tangent_vec_diff = (
              tangent_vec[:, id_vertices[0]]
              - tangent_vec[:, id_vertices[1]]
          )
          values = gs.einsum(
              "bd,nbd->nbd",
              gs.stack([gs.flatten(cot)] * 3, axis=1),
              tangent_vec_diff,
          )
  
          laplacian_at_tangent_vec = gs.zeros(
              (n_tangent_vecs, n_vertices, 3)
          )
  
          id_vertices_201_repeated = gs.tile(
              id_vertices[1, :], (n_tangent_vecs, 1)
          )
  
          for i_dim in range(3):
              laplacian_at_tangent_vec[:, :, i_dim] = gs.scatter_add(
                  input=gs.cast(
                      laplacian_at_tangent_vec[:, :, i_dim],
                      dtype=values[:, :, i_dim].dtype,
                  ),
                  dim=1,
                  index=id_vertices_201_repeated,
                  src=values[:, :, i_dim],
              )
          return (
              gs.squeeze(laplacian_at_tangent_vec, axis=0)
              if to_squeeze
              else laplacian_at_tangent_vec
          )
  
      return _laplacian
  
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 16 for calling the DiscreteSurfaces obj's underlying member method code with example usage: obj.laplacian(point) and returns: _laplacian, unknown