code: def spectra_helper(spec_func, triplet):
      k, m, n = triplet
      min_dim = min(m, n)
      sigma = np.diag([spec_func(i + 1, k) for i in range(min_dim)])
      seed = 1025
      np.random.seed(seed)
      U = np.linalg.qr(np.random.normal(0, 1, (m, min_dim)))[0]
      V = np.linalg.qr(np.random.normal(0, 1, (n, min_dim)))[0]
      A = U @ sigma @ V.T
      mt_A = matrix_table_from_numpy(A)
  
      eigenvalues, scores, loadings = hl._blanczos_pca(
          mt_A.ent,
          k=k,
          oversampling_param=k,
          compute_loadings=True,
          q_iterations=4,
      )
      singulars = np.sqrt(eigenvalues)
      hail_V = (np.array(scores.scores.collect()) / singulars).T
      hail_U = np.array(loadings.loadings.collect())
      approx_A = hail_U @ np.diag(singulars) @ hail_V
      norm_of_diff = np.linalg.norm(A - approx_A, 2)
      np.testing.assert_allclose(
          norm_of_diff,
          spec_func(k + 1, k),
          rtol=1e-02,
          err_msg=f"Norm test failed on triplet {triplet} ",
      )
      np.testing.assert_allclose(
          singulars,
          np.diag(sigma)[:k],
          rtol=1e-01,
          err_msg=f"Failed on triplet {triplet}",
      )
  
imports: import math
  import pytest
  import numpy
  import hail
  from hail.methods.pca import _make_tsm
  from ..helpers import resource, fails_local_backend, skip_when_service_backend, test_timeout
label_desc: Use image node_id 7 for calling a global function with example usage: spectra_helper(spec_func, triplet) without return types