class_docstr: Class for Riemannian and pseudo-Riemannian metrics.
  
  The associated Levi-Civita connection on the tangent bundle.
class_docstr_tok: ["Class","for","Riemannian","and","pseudo-Riemannian","metrics",".","The","associated","Levi-Civita","connection","on","the","tangent","bundle","."]
docstr: Compute the hamiltonian energy associated to the cometric.
  
  The Hamiltonian at state :math:`(q, p)` is defined by
  
  .. math::
      H(q, p) = \frac{1}{2} <p, p>_q
  
  where :math:`<\cdot, \cdot>_q` is the cometric at :math:`q`.
  
  Parameters
  ----------
  state : tuple of arrays
      Position and momentum variables. The position is a point on the
      manifold, while the momentum is cotangent vector.
  
  Returns
  -------
  energy : float
      Hamiltonian energy at `state`.
docstr_tok: ["Compute","the","hamiltonian","energy","associated","to","the","cometric",".","The","Hamiltonian","at","state",":","math",":","`","(","q",",","p",")","`","is","defined","by","..","math",":",":","H","(","q",",","p",")","=","\\frac","{","1","}","{","2","}","<","p",",","p",">","_q","where",":","math",":","`","<","\\cdot",",","\\cdot",">","_q","`","is","the","cometric","at",":","math",":","`","q","`",".","Parameters","--","--","--","--","--","state",":","tuple","of","arrays","Position","and","momentum","variables",".","The","position","is","a","point","on","the","manifold",",","while","the","momentum","is","cotangent","vector",".","Returns","--","--","--","-","energy",":","float","Hamiltonian","energy","at","`","state","`","."]
code: def hamiltonian(self, state):
      r"""Compute the hamiltonian energy associated to the cometric.
  
      The Hamiltonian at state :math:`(q, p)` is defined by
  
      .. math::
          H(q, p) = \frac{1}{2} <p, p>_q
  
      where :math:`<\cdot, \cdot>_q` is the cometric at :math:`q`.
  
      Parameters
      ----------
      state : tuple of arrays
          Position and momentum variables. The position is a point on the
          manifold, while the momentum is cotangent vector.
  
      Returns
      -------
      energy : float
          Hamiltonian energy at `state`.
      """
      position, momentum = state
      return (
          1.0 / 2 * self.inner_coproduct(momentum, momentum, position)
      )
  
imports: from abc import ABC
  import joblib
  import geomstats.backend
  import geomstats.geometry
  from geomstats.geometry.connection import Connection
  from geomstats.vectorization import check_is_batch
label_desc: Use image node_id 10 for calling the RiemannianMetric obj's underlying member method code with example usage: obj.hamiltonian(state) and returns: unknown