docstr: Compute Hamiltonian functions using a position and momentum.
docstr_tok: ["Compute","Hamiltonian","functions","using","a","position","and","momentum","."]
code: def compute_state(self, q: RaveledVars, p: RaveledVars):
      """Compute Hamiltonian functions using a position and momentum."""
      if q.data.dtype != self._dtype or p.data.dtype != self._dtype:
          raise ValueError("Invalid dtype. Must be %s" % self._dtype)
  
      logp, dlogp = self._logp_dlogp_func(q)
  
      v = self._potential.velocity(p.data, out=None)
      kinetic = self._potential.energy(p.data, velocity=v)
      energy = kinetic - logp
      return State(q, p, v, dlogp, energy, logp, 0)
  
file_path: pymc/pymc/step_methods/hmc/integration.py
imports: from typing import NamedTuple
  import numpy
  from scipy import linalg
  from pymc.blocking import RaveledVars
  from pymc.step_methods.hmc.quadpotential import QuadPotential
label_desc: Use image node_id 2 for calling the CpuLeapfrogIntegrator obj's underlying member method code with example usage: obj.compute_state(q, p) and returns: State