code: def test_for_the_easy_case(self):
      # `H` is chosen such that `g` is not orthogonal to the
      # eigenvector associated with the smallest eigenvalue.
      H = np.array([[1.0, 0.0, 4.0], [0.0, 2.0, 0.0], [4.0, 0.0, 3.0]])
      g = np.array([5.0, 0.0, 4.0])
  
      # Trust Radius
      trust_radius = 1.0
  
      # Solve Subproblem
      subprob = KrylovQP(
          x=0,
          fun=lambda x: 0,
          jac=lambda x: g,
          hess=lambda x: None,
          hessp=lambda x, y: H.dot(y),
      )
      p, hits_boundary = subprob.solve(trust_radius)
  
      assert_array_almost_equal(p, np.array([-1.0, 0.0, 0.0]))
      assert_equal(hits_boundary, True)
      # check kkt satisfaction
      assert_almost_equal(
          np.linalg.norm(H.dot(p) + subprob.lam * p + g), 0.0
      )
      # check trust region constraint
      assert_almost_equal(np.linalg.norm(p), trust_radius)
  
      trust_radius = 0.5
      p, hits_boundary = subprob.solve(trust_radius)
  
      assert_array_almost_equal(
          p, np.array([-0.46125446, 0.0, -0.19298788])
      )
      assert_equal(hits_boundary, True)
      # check kkt satisfaction
      assert_almost_equal(
          np.linalg.norm(H.dot(p) + subprob.lam * p + g), 0.0
      )
      # check trust region constraint
      assert_almost_equal(np.linalg.norm(p), trust_radius)
  
file_path: catboost/contrib/python/scipy/py3/scipy/optimize/tests/test_trustregion_krylov.py
imports: import numpy
  from scipy.optimize._trlib import get_trlib_quadratic_subproblem
  from numpy.testing import assert_, assert_almost_equal, assert_equal, assert_array_almost_equal
label_desc: Use image node_id 1 for calling the TestKrylovQuadraticSubproblem obj's underlying member method code with example usage: obj.test_for_the_easy_case() without return types