code: def assert_cov_validity(
      cov, eigenvalue_lbnd=0.0, condition_number_ubnd=1e6
  ):
      """
      cov: covariance matrix
      eigenvalue_lbnd: eigenvalues should be at least this much greater than
        zero. Must be strictly positive.
      condition_number_ubnd: inclusive upper bound on matrix condition
        number. Must be greater or equal to 1.0.
      """
      assert (
          eigenvalue_lbnd >= 0.0
      ), "Covariance eigenvalue lower bound must be > 0.0!"
      assert (
          condition_number_ubnd >= 1.0
      ), "Covariance condition number bound must be >= 1.0!"
  
      # Symmetry
      assert (cov.t() == cov).all(), "Covariance must be symmetric!"
      # Precompute eigenvalues for subsequent tests.
      ws = torch.linalg.eigvalsh(cov)  # The eigenvalues of cov
      w_min = torch.min(ws)
      w_max = torch.max(ws)
  
      # Strict positivity
      assert w_min > 0.0, "Covariance must be strictly positive!"
  
      # Eigenvalue lower bound
      assert (
          w_min >= eigenvalue_lbnd
      ), "Covariance eigenvalues must be >= lower bound!"
  
      # Condition number upper bound
      assert (
          w_max / w_min <= condition_number_ubnd
      ), "Condition number must be <= upper bound!"
  
file_path: pyro/tests/contrib/tracking/test_dynamic_models.py
imports: import torch
  from pyro.contrib.tracking.dynamic_models import NcpContinuous, NcpDiscrete, NcvContinuous, NcvDiscrete
  from tests.common import assert_equal, assert_not_equal
label_desc: Use image node_id 1 for calling a global function with example usage: assert_cov_validity(cov, eigenvalue_lbnd, condition_number_ubnd) without return types