code: def _third_order(B3, Y_res, C3, R, n3, m3, lambdax):
      """Compute third order sensitivities."""
      Y_ijk = np.empty((R, n3))  # Initialize 3rd order contributions
      T3 = np.empty((m3, R))  # Initialize T(emporary) matrix - 1st
  
      lam_eye_m3 = lambdax * identity(m3)
  
      # Avoid memory allocations by using temporary store
      B3_j = np.empty(B3[:, :, 0].shape)
      B33 = np.empty((m3, m3))
  
      # First order individual estimation
      for j in range(n3):
          # Regularized least squares inversion ( minimize || C1 ||_2 )
          B3_j[:, :] = B3[:, :, j]
          B33[:, :] = B3_j.T @ B3_j
  
          # if it is ill-conditioned matrix, the default value is zero
          if np.all(svd(B33)[1]):  # sigma, diagonal matrix, from svd
              T3[:, :] = lin_solve(B33 + lam_eye_m3, B3_j.T)
          else:
              T3[:, :] = 0.0
  
          C3[:, j] = T3 @ Y_res
          Y_ijk[:, j] = B3_j @ C3[:, j]
  
      return (Y_ijk, C3)
  
imports: from typing import Dict
  from types import MethodType
  import itertools
  import time
  import warnings
  import numpy
  from numpy.linalg import solve
  from numpy.linalg import svd
  from numpy import identity
  import pandas
  from scipy import stats, special, interpolate
  from .None import common_args
  from ..util import read_param_file, ResultDict
  from SALib.plotting.hdmr import plot
  from SALib.util.problem import ProblemSpec
label_desc: Use image node_id 8 for calling a global function with example usage: _third_order(B3, Y_res, C3, R, n3, m3, lambdax) and returns: Y_ijk,  C3