code: def _full_rank(X, cmax=1e15):
      """
      This function possibly adds a scalar matrix to X
      to guarantee that the condition number is smaller than a given threshold.
  
      Parameters
      ----------
      X: array of shape(nrows, ncols)
      cmax=1.e-15, float tolerance for condition number
  
      Returns
      -------
      X: array of shape(nrows, ncols) after regularization
      cmax=1.e-15, float tolerance for condition number
      """
      U, s, V = np.linalg.svd(X, 0)
      smax, smin = s.max(), s.min()
      c = smax / smin
      if c < cmax:
          return X, c
      warn("Matrix is singular at working precision, regularizing...")
      lda = (smax - cmax * smin) / (cmax - 1)
      s = s + lda
      X = np.dot(U, np.dot(np.diag(s), V))
      return X, cmax
  
file_path: nipy/nipy/modalities/fmri/design_matrix.py
imports: from warnings import warn
  import numpy
  from .hemodynamic_models import _orthogonalize, compute_regressor
label_desc: Use image node_id 6 for calling a global function with example usage: _full_rank(X, cmax) and returns: X,  cmax, X,  c