code: def test_fast_svd(n_features, rng):
      n_samples = 100
      k = 10
  
      # generate a matrix X of approximate effective rank `rank` and no noise
      # component (very structured signal):
      U = rng.normal(size=(n_samples, k))
      V = rng.normal(size=(k, n_features))
      X = np.dot(U, V)
  
      assert X.shape == (n_samples, n_features)
  
      # compute the singular values of X using the slow exact method
      _, _, V_ = linalg.svd(X, full_matrices=False)
  
      Ur, _, Vr = _fast_svd(X, k, random_state=0)
  
      assert Vr.shape == (k, n_features)
      assert Ur.shape == (n_samples, k)
      # check the singular vectors too (while not checking the sign)
      assert_array_almost_equal(
          np.abs(np.diag(np.corrcoef(V_[:k], Vr)))[:k], np.ones(k)
      )
  
file_path: nilearn/nilearn/decomposition/tests/test_base.py
imports: import numpy
  import pytest
  from nibabel import Nifti1Image
  from numpy.testing import assert_array_almost_equal
  from scipy import linalg
  from nilearn.conftest import _affine_eye, _img_3d_ones, _rng
  from nilearn.decomposition._base import _fast_svd, _mask_and_reduce
  from nilearn.maskers import MultiNiftiMasker
label_desc: Use image node_id 3 for calling a global function with example usage: test_fast_svd(n_features, rng) without return types