docstr: Tests qdwh with rank-deficient input.
docstr_tok: ["Tests","qdwh","with","rank-deficient","input","."]
code: def testQdwhWithOnRankDeficientInput(self, m, n, log_cond):
      """Tests qdwh with rank-deficient input."""
      a = np.triu(np.ones((m, n))).astype(_QDWH_TEST_DTYPE)
  
      # Generates a rank-deficient input.
      u, s, v = np.linalg.svd(a, full_matrices=False)
      cond = 10**log_cond
      s = jnp.linspace(cond, 1, min(m, n))
      s = jnp.expand_dims(s.at[-1].set(0), range(u.ndim - 1))
      a = (u * s) @ v
  
      is_hermitian = _check_symmetry(a)
      max_iterations = 15
      actual_u, actual_h, _, _ = qdwh.qdwh(
          a, is_hermitian=is_hermitian, max_iterations=max_iterations
      )
      _, expected_h = osp_linalg.polar(a)
  
      # For rank-deficient matrix, `u` is not unique.
      with self.subTest("Test h."):
          relative_diff_h = _compute_relative_diff(actual_h, expected_h)
          np.testing.assert_almost_equal(
              relative_diff_h, 1e-6, decimal=5
          )
  
      with self.subTest("Test u.dot(h)."):
          a_round_trip = _dot(actual_u, actual_h)
          relative_diff_a = _compute_relative_diff(a_round_trip, a)
          np.testing.assert_almost_equal(
              relative_diff_a, 1e-6, decimal=5
          )
  
      with self.subTest("Test orthogonality."):
          actual_results = _dot(actual_u.T.conj(), actual_u)
          expected_results = np.eye(n)
          self.assertAllClose(
              actual_results,
              expected_results,
              rtol=_QDWH_TEST_EPS,
              atol=1e-6,
          )
  
file_path: jax/tests/qdwh_test.py
imports: import functools
  import jax
  import jax.numpy
  import numpy
  import scipy.linalg
  from jax._src import config
  from jax._src import test_util
  from jax._src.lax import qdwh
  from absl.testing import absltest
label_desc: Use image node_id 4 for calling the QdwhTest obj's underlying member method code with example usage: obj.testQdwhWithOnRankDeficientInput(m, n, log_cond) without return types