docstr: Tests qdwh with upper triangular input of all ones.
docstr_tok: ["Tests","qdwh","with","upper","triangular","input","of","all","ones","."]
code: def testQdwhWithUpperTriangularInputAllOnes(self, m, n, log_cond):
      """Tests qdwh with upper triangular input of all ones."""
      a = jnp.triu(jnp.ones((m, n))).astype(_QDWH_TEST_DTYPE)
      u, s, v = jnp.linalg.svd(a, full_matrices=False)
      cond = 10**log_cond
      s = jnp.expand_dims(
          jnp.linspace(cond, 1, min(m, n)), range(u.ndim - 1)
      )
      a = (u * s) @ v
      is_hermitian = _check_symmetry(a)
      max_iterations = 10
  
      actual_u, actual_h, _, _ = qdwh.qdwh(
          a, is_hermitian=is_hermitian, max_iterations=max_iterations
      )
      expected_u, expected_h = osp_linalg.polar(a)
  
      # Sets the test tolerance.
      rtol = 1e6 * _QDWH_TEST_EPS
  
      with self.subTest("Test u."):
          relative_diff_u = _compute_relative_diff(actual_u, expected_u)
          np.testing.assert_almost_equal(
              relative_diff_u, 1e-6, decimal=5
          )
  
      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, actual_u)
          expected_results = np.eye(n)
          self.assertAllClose(
              actual_results, expected_results, rtol=rtol, atol=1e-5
          )
  
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 2 for calling the QdwhTest obj's underlying member method code with example usage: obj.testQdwhWithUpperTriangularInputAllOnes(m, n, log_cond) without return types