code: def _comp_func(b_m, hdmr, t=None, emulator=None):
      """Computes the component function based on basis matrix and the solution
  
      Parameters
      ----------
      b_m : numpy.array
          Basis matrix
      hdmr : namedtuple
          Core parameters of hdmr expansion
      t : int
          Bootstrap iteration
      emulator : bool
          Whether it is called by emulator or not
  
      Returns
      -------
      Y_e : numpy.array
          Emualated model output for each components
      """
      Y_t = np.zeros((b_m.shape[0], hdmr.a_tnt))
      Y_e = np.zeros((b_m.shape[0], hdmr.nc_t))
  
      # Temporary matrix
      if (
          emulator
      ):  # Use average of solutions if it is called by emulator
          Y_t = np.multiply(
              b_m, np.tile(hdmr.x.mean(axis=1), [b_m.shape[0], 1])
          )
      else:  #  Use the t-th solution if it is called by fanova
          Y_t = np.multiply(
              b_m, np.tile(hdmr.x[:, t], [b_m.shape[0], 1])
          )
  
      # First order component functions
      for i in range(hdmr.nc1):
          Y_e[:, i] = np.sum(
              Y_t[:, i * hdmr.p_o : (i + 1) * hdmr.p_o], axis=1
          )
  
      # Second order component functions
      if hdmr.max_order > 1:
          for i in range(hdmr.nc2):
              Y_e[:, hdmr.nc1 + i] = np.sum(
                  Y_t[
                      :,
                      hdmr.tnt1
                      + (i) * hdmr.nt2 : hdmr.tnt1
                      + (i + 1) * hdmr.nt2,
                  ],
                  axis=1,
              )
  
      # Third order component functions
      if hdmr.max_order == 3:
          for i in range(hdmr.nc3):
              Y_e[:, hdmr.nc1 + hdmr.nc2 + i] = np.sum(
                  Y_t[
                      :,
                      hdmr.tnt1
                      + hdmr.tnt2
                      + (i) * hdmr.nt3 : hdmr.tnt1
                      + hdmr.tnt2
                      + (i + 1) * hdmr.nt3,
                  ],
                  axis=1,
              )
  
      return Y_e
  
imports: import math
  import warnings
  from typing import Dict, Tuple
  from types import MethodType
  from itertools import combinations, product
  from collections import defaultdict, namedtuple
  import numpy
  from pandas import DataFrame
  from numpy.linalg import det, pinv, matrix_rank
  from scipy.linalg import svd, LinAlgError, solve
  from scipy import stats, special
  from .None import common_args
  from ..util import read_param_file, ResultDict
label_desc: Use image node_id 13 for calling a global function with example usage: _comp_func(b_m, hdmr, t, emulator) and returns: Y_e