code: def eig_3d(H):
      """
      Returns the eigenvalues of a symmetric batched 3-D matrix
      """
      p1 = (
          H[..., 0, 1].pow(2)
          + H[..., 0, 2].pow(2)
          + H[..., 1, 2].pow(2)
      )
      q = (H[..., 0, 0] + H[..., 1, 1] + H[..., 2, 2]) / 3
      p2 = (
          (H[..., 0, 0] - q).pow(2)
          + (H[..., 1, 1] - q).pow(2)
          + (H[..., 2, 2] - q).pow(2)
          + 2 * p1
      )
      p = torch.sqrt(p2 / 6)
      B = (1 / p).unsqueeze(-1).unsqueeze(-1) * (
          H - q.unsqueeze(-1).unsqueeze(-1) * torch.eye(3)
      )
      r = determinant_3d(B) / 2
      phi = (
          (r.acos() / 3)
          .unsqueeze(-1)
          .unsqueeze(-1)
          .expand(r.shape + (3, 3))
          .clone()
      )
      phi[r < -1 + 1e-6] = math.pi / 3
      phi[r > 1 - 1e-6] = 0.0
  
      eig1 = q + 2 * p * torch.cos(phi[..., 0, 0])
      eig2 = q + 2 * p * torch.cos(phi[..., 0, 0] + (2 * math.pi / 3))
      eig3 = 3 * q - eig1 - eig2
      # eig2 <= eig3 <= eig1
      return eig2, eig3, eig1
  
file_path: pyro/pyro/ops/linalg.py
imports: import math
  import warnings
  from contextlib import contextmanager
  import torch
label_desc: Use image node_id 4 for calling a global function with example usage: eig_3d(H) and returns: eig2,  eig3,  eig1