code: def _diff_inv_matrix(x, lag, differences, xi):
      n, m = x.shape
      y = np.zeros((n + lag * differences, m), dtype=DTYPE)
  
      if m >= 1:  # todo: R checks this. do we need to?
          # R: if(missing(xi)) xi <- matrix(0.0, lag*differences, m)
          if xi is None:
              xi = np.zeros((lag * differences, m), dtype=DTYPE)
          else:
              xi = skval.check_array(
                  xi,
                  dtype=DTYPE,
                  copy=False,
                  force_all_finite=False,
                  ensure_2d=True,
              )
              if xi.shape != (lag * differences, m):
                  raise IndexError('"xi" does not have the right shape')
  
          # TODO: can we vectorize?
          for i in range(m):
              y[:, i] = _diff_inv_vector(
                  x[:, i], lag, differences, xi[:, i]
              )
  
      return y
  
file_path: pmdarima/pmdarima/utils/array.py
imports: from sklearn.utils import validation
  import numpy
  import pandas
  from ..compat import DTYPE
  from ._array import C_intgrt_vec
label_desc: Use image node_id 9 for calling a global function with example usage: _diff_inv_matrix(x, lag, differences, xi) and returns: y