code: def test_for_random_entries(self):
      # Seed
      np.random.seed(1)
  
      # Dimension
      n = 5
  
      for case in ("easy", "hard", "jac_equal_zero"):
          eig_limits = [
              (-20, -15),
              (-10, -5),
              (-10, 0),
              (-5, 5),
              (-10, 10),
              (0, 10),
              (5, 10),
              (15, 20),
          ]
  
          for min_eig, max_eig in eig_limits:
              # Generate random symmetric matrix H with
              # eigenvalues between min_eig and max_eig.
              H, g = random_entry(n, min_eig, max_eig, case)
  
              # Trust radius
              trust_radius_list = [
                  0.1,
                  0.3,
                  0.6,
                  0.8,
                  1,
                  1.2,
                  3.3,
                  5.5,
                  10,
              ]
  
              for trust_radius in trust_radius_list:
                  # Solve subproblem with very high accuracy
                  subprob_ac = IterativeSubproblem(
                      0,
                      lambda x: 0,
                      lambda x: g,
                      lambda x: H,
                      k_easy=1e-10,
                      k_hard=1e-10,
                  )
  
                  p_ac, hits_boundary_ac = subprob_ac.solve(
                      trust_radius
                  )
  
                  # Compute objective function value
                  J_ac = 1 / 2 * np.dot(p_ac, np.dot(H, p_ac)) + np.dot(
                      g, p_ac
                  )
  
                  stop_criteria = [(0.1, 2), (0.5, 1.1), (0.9, 1.01)]
  
                  for k_opt, k_trf in stop_criteria:
                      # k_easy and k_hard computed in function
                      # of k_opt and k_trf accordingly to
                      # Conn, A. R., Gould, N. I., & Toint, P. L. (2000).
                      # "Trust region methods". Siam. p. 197.
                      k_easy = min(k_trf - 1, 1 - np.sqrt(k_opt))
                      k_hard = 1 - k_opt
  
                      # Solve subproblem
                      subprob = IterativeSubproblem(
                          0,
                          lambda x: 0,
                          lambda x: g,
                          lambda x: H,
                          k_easy=k_easy,
                          k_hard=k_hard,
                      )
                      p, hits_boundary = subprob.solve(trust_radius)
  
                      # Compute objective function value
                      J = 1 / 2 * np.dot(p, np.dot(H, p)) + np.dot(g, p)
  
                      # Check if it respect k_trf
                      if hits_boundary:
                          assert_array_equal(
                              np.abs(norm(p) - trust_radius)
                              <= (k_trf - 1) * trust_radius,
                              True,
                          )
                      else:
                          assert_equal(norm(p) <= trust_radius, True)
  
                      # Check if it respect k_opt
                      assert_equal(J <= k_opt * J_ac, True)
  
imports: from __future__ import division, print_function, absolute_import
  import numpy
  from scipy.optimize._trustregion_exact import estimate_smallest_singular_value, singular_leading_submatrix, IterativeSubproblem
  from scipy.linalg import svd, get_lapack_funcs, det, cho_factor, cho_solve, qr, eigvalsh, eig, norm
  from numpy.testing import assert_, assert_array_equal, assert_equal, assert_array_almost_equal, assert_array_less
label_desc: Use image node_id 6 for calling the TestIterativeSubproblem obj's underlying member method code with example usage: obj.test_for_random_entries() without return types