class_docstr: Tests regularization/postprocessing methods.
class_docstr_tok: ["Tests","regularization\/postprocessing","methods","."]
docstr: Test obtaining the closest positive semi-definite matrix using a
  semi-definite program with a small perturbation input.
  
  The small perturbation ensures that the solver does not get stuck.
docstr_tok: ["Test","obtaining","the","closest","positive","semi-definite","matrix","using","a","semi-definite","program","with","a","small","perturbation","input",".","The","small","perturbation","ensures","that","the","solver","does","not","get","stuck","."]
code: def test_closest_psd_matrix_small_perturb(self):
      """Test obtaining the closest positive semi-definite matrix using a
      semi-definite program with a small perturbation input.
  
      The small perturbation ensures that the solver does not get stuck.
      """
      input, fix_diagonal, expected_output = (
          np.array([[0, 1.000001], [1, 0]]),
          True,
          np.array([[1, 1], [1, 1]]),
      )
      try:
          import cvxpy as cp
  
          output = kern.closest_psd_matrix(
              input, fix_diagonal=fix_diagonal, feastol=1e-10
          )
      except cp.error.SolverError:
          pytest.skip(
              "The cvxopt solver seems to not be installed on the system."
              "It is the default solver for qml.kernels.closest_psd_matrix"
              " and can be installed via `pip install cvxopt`."
          )
  
      assert np.allclose(output, expected_output, atol=1e-5)
  
imports: import math
  import sys
  from functools import partial
  import pytest
  import numpy
  import pennylane
  import pennylane.kernels
  from pennylane import numpy
label_desc: Use image node_id 6 for calling the TestRegularization obj's underlying member method code with example usage: obj.test_closest_psd_matrix_small_perturb() without return types