code: def full_rank(X, cmax=1e15):
      """Compute the condition number of X and if it is larger than cmax, \
      returns a matrix with a condition number smaller than cmax.
  
      Parameters
      ----------
      X : array of shape (nrows, ncols)
          Input array.
  
      cmax : float, default=1e15
          Tolerance for condition number.
  
      Returns
      -------
      X : array of shape (nrows, ncols)
          Output array.
  
      cond : float,
          Actual condition number.
  
      """
      U, s, V = spl.svd(X, full_matrices=False)
      smax, smin = s.max(), s.min()
      cond = smax / smin
      if cond < cmax:
          return X, cond
  
      warn("Matrix is singular at working precision, regularizing...")
      lda = (smax - cmax * smin) / (cmax - 1)
      X = np.dot(U, np.dot(np.diag(s + lda), V))
      return X, cmax
  
file_path: nilearn/nilearn/glm/_utils.py
imports: from warnings import warn
  import numpy
  import scipy.linalg
  from scipy.stats import norm
label_desc: Use image node_id 4 for calling a global function with example usage: full_rank(X, cmax) and returns: X,  cmax, X,  cond