docstr: Tests singular values.
docstr_tok: ["Tests","singular","values","."]
code: def testSingularValues(self, m, n, log_cond, full_matrices):
      """Tests singular values."""
      with jax.default_matmul_precision("float32"):
          a = np.random.uniform(low=0.3, high=0.9, size=(m, n)).astype(
              _SVD_TEST_DTYPE
          )
          u, s, v = osp_linalg.svd(a, full_matrices=False)
          cond = 10**log_cond
          s = np.linspace(cond, 1, min(m, n))
          a = (u * s) @ v
          a = a + 1j * a
  
          # Only computes singular values.
          compute_uv = False
  
          osp_linalg_fn = functools.partial(
              osp_linalg.svd,
              full_matrices=full_matrices,
              compute_uv=compute_uv,
          )
          actual_s = svd.svd(
              a, full_matrices=full_matrices, compute_uv=compute_uv
          )
  
          expected_s = osp_linalg_fn(a)
  
          svd_fn = lambda a: svd.svd(a, full_matrices=full_matrices)
          args_maker = lambda: [a]
  
          with self.subTest("Test JIT compatibility"):
              self._CompileAndCheck(svd_fn, args_maker)
  
          with self.subTest("Test s."):
              self.assertAllClose(
                  expected_s, actual_s, rtol=_SVD_RTOL, atol=1e-6
              )
  
          with self.subTest("Test non-increasing order."):
              # Computes `actual_diff[i] = s[i+1] - s[i]`.
              actual_diff = jnp.diff(actual_s, append=0)
              np.testing.assert_array_less(
                  actual_diff, np.zeros_like(actual_diff)
              )
  
file_path: jax/tests/svd_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 svd
  from absl.testing import absltest
label_desc: Use image node_id 5 for calling the SvdTest obj's underlying member method code with example usage: obj.testSingularValues(m, n, log_cond, full_matrices) without return types