code: def makeTBATSFMatrix(
      phi,
      tau,
      alpha,
      beta,
      ar_coeffs,
      ma_coeffs,
      gamma_bold,
      seasonal_periods,
      k_vector,
  ):
      # Alpha row
      F = np.array([[1.0]])
      if phi is not None:
          F = np.hstack((F, np.array([[phi]])))
      F = np.hstack((F, np.zeros((1, tau))))
      if ar_coeffs is not None:
          alpha_varphi = alpha * ar_coeffs
          alpha_varphi = alpha_varphi.reshape((1, len(alpha_varphi)))
          F = np.hstack((F, alpha_varphi))
      if ma_coeffs is not None:
          alpha_theta = alpha * ma_coeffs
          alpha_theta = alpha_theta.reshape((1, len(alpha_theta)))
          F = np.hstack((F, alpha_theta))
  
      # Beta row
      if beta is not None:
          beta_row = np.array([[0.0, phi]])
          beta_row = np.hstack((beta_row, np.zeros((1, tau))))
          if ar_coeffs is not None:
              beta_varphi = beta * ar_coeffs
              beta_varphi = beta_varphi.reshape((1, len(beta_varphi)))
              beta_row = np.hstack((beta_row, beta_varphi))
          if ma_coeffs is not None:
              beta_theta = beta * ma_coeffs
              beta_theta = beta_theta.reshape((1, len(beta_theta)))
              beta_row = np.hstack((beta_row, beta_theta))
          F = np.vstack((F, beta_row))
  
      # Seasonal row
      seasonal_row = np.zeros((tau, 1))
  
      if phi is not None:
          seasonal_row = np.hstack((seasonal_row, np.zeros((tau, 1))))
  
      A = np.zeros((tau, tau))
      pos = 0
      for k, period in zip(k_vector, seasonal_periods):
          t = 2 * np.pi * np.arange(1, k + 1) / period
          ck = np.diag(np.cos(t))
          sk = np.diag(np.sin(t))
          top = np.hstack((ck, sk))
          bottom = np.hstack((-sk, ck))
          Ak = np.vstack((top, bottom))
          A[pos : pos + 2 * k, pos : pos + 2 * k] = Ak
          pos += 2 * k
      seasonal_row = np.hstack((seasonal_row, A))
  
      if ar_coeffs is not None:
          varphi = ar_coeffs.reshape((1, ar_coeffs.shape[0]))
          B = np.dot(np.transpose(gamma_bold), varphi)
          seasonal_row = np.hstack((seasonal_row, B))
  
      if ma_coeffs is not None:
          theta = ma_coeffs.reshape((1, ma_coeffs.shape[0]))
          C = np.dot(np.transpose(gamma_bold), theta)
          seasonal_row = np.hstack((seasonal_row, C))
  
      F = np.vstack((F, seasonal_row))
  
      # ARMA submatrix
      if ar_coeffs is not None:
          p = len(ar_coeffs)
          ar_rows = np.zeros((p, 1))
  
          if phi is not None:
              ar_rows = np.hstack((ar_rows, ar_rows))
  
          ar_seasonal_zeros = np.zeros((p, tau))  # seasonal part
          ar_rows = np.hstack((ar_rows, ar_seasonal_zeros))
  
          ident = np.eye(p - 1)
          ident = np.hstack((ident, np.zeros(((p - 1), 1))))
  
          ar_part = np.vstack(
              (ar_coeffs.reshape((1, ar_coeffs.shape[0])), ident)
          )
          ar_rows = np.hstack((ar_rows, ar_part))
  
          if ma_coeffs is not None:
              q = len(ma_coeffs)
              ma_in_ar = np.zeros((p, q))
              ma_in_ar[0, :] = ma_coeffs
              ar_rows = np.hstack((ar_rows, ma_in_ar))
  
          F = np.vstack((F, ar_rows))
  
      if ma_coeffs is not None:
          q = len(ma_coeffs)
          ma_rows = np.zeros((q, 1))
  
          if phi is not None:
              ma_rows = np.hstack((ma_rows, ma_rows))
  
          ma_seasonal = np.zeros((q, tau))
          ma_rows = np.hstack((ma_rows, ma_seasonal))
  
          if ar_coeffs is not None:
              p = len(ar_coeffs)
              ar_in_ma = np.zeros((q, p))
              ma_rows = np.hstack((ma_rows, ar_in_ma))
  
          ident = np.eye(q - 1)
          ident = np.hstack((ident, np.zeros(((q - 1), 1))))
          ma_part = np.vstack((np.zeros((1, q)), ident))
          ma_rows = np.hstack((ma_rows, ma_part))
  
          F = np.vstack((F, ma_rows))
  
      return F
  
imports: import warnings
  from functools import partial
  import numpy
  import pandas
  import scipy.linalg
  import statsmodels.api
  from numba import njit
  from numpy.polynomial.polynomial import Polynomial
  from scipy.special import inv_boxcox
  from scipy.stats import boxcox
  from scipy.optimize import minimize
  from statsmodels.tsa.stattools import adfuller
  from .arima import auto_arima_f
  from .utils import NOGIL, CACHE
label_desc: Use image node_id 7 for calling a global function with example usage: makeTBATSFMatrix(phi, tau, alpha, beta, ar_coeffs, ma_coeffs, gamma_bold, seasonal_periods, k_vector) and returns: F