code: def test_svd_compressed(iterator):
      m, n = 100, 50
      r = 5
      a = da.random.default_rng().random((m, n), chunks=(m, n))
  
      # calculate approximation and true singular values
      u, s, vt = svd_compressed(
          a,
          2 * r,
          iterator=iterator[0],
          n_power_iter=iterator[1],
          seed=4321,
      )  # worst case
      s_true = scipy.linalg.svd(a.compute(), compute_uv=False)
  
      # compute the difference with original matrix
      norm = scipy.linalg.norm(
          (a - (u[:, :r] * s[:r]) @ vt[:r, :]).compute(), 2
      )
  
      # ||a-a_hat||_2 <= (1+tol)s_{k+1}: based on eq. 1.10/1.11:
      # Halko, Nathan, Per-Gunnar Martinsson, and Joel A. Tropp.
      # "Finding structure with randomness: Probabilistic algorithms for constructing
      # approximate matrix decompositions." SIAM review 53.2 (2011): 217-288.
      frac = norm / s_true[r + 1] - 1
      # Tolerance determined via simulation to be slightly above max norm of difference matrix in 10k samples.
      # See https://github.com/dask/dask/pull/6799#issuecomment-726631175 for more details.
      tol = 0.4
      assert frac < tol
  
      assert_eq(
          np.eye(r, r), da.dot(u[:, :r].T, u[:, :r])
      )  # u must be orthonormal
      assert_eq(np.eye(r, r), da.dot(vt[:r, :], vt[:r, :].T))
  
imports: from __future__ import annotations
  import sys
  import pytest
  import numpy
  import scipy.linalg
  from packaging.version import parse
  import dask.array
  from dask.array.linalg import qr, sfqr, svd, svd_compressed, tsqr
  from dask.array.numpy_compat import _np_version
  from dask.array.utils import assert_eq, same_keys, svd_flip
label_desc: Use image node_id 9 for calling a global function with example usage: test_svd_compressed(iterator) without return types