def setup_t_matrix(dq_W_E_vec, dq_B_H_vec):
  """This sets up the [6nx8] T matrix consisting of multiple S matrices for the
  different pose pairs. See Equation (33) of the referenced paper.

  T = (S_1.T S_2.T ... S_n.T).T
  """
  n_quaternions = len(dq_W_E_vec)
  t_matrix = np.zeros([6 * n_quaternions, 8])
  for i in range(n_quaternions):
    t_matrix[i * 6:i * 6 + 6, :] = setup_s_matrix(dq_W_E_vec[i], dq_B_H_vec[i])

  rank_t_matrix = np.linalg.matrix_rank(t_matrix, tol=5e-2)
  U, s, V = np.linalg.svd(t_matrix)
  # print("t_matrix: \n{}".format(t_matrix))
  # print("Rank(t_matrix): {}".format(rank_t_matrix))
  # assert rank_t_matrix == 6, ("T should have rank 6 otherwise we can not find "
  #                             "a rigid transform.", rank_t_matrix, s)
  return t_matrix.copy()
This sets up the [6nx8] T matrix consisting of multiple S matrices for the
  different pose pairs. See Equation (33) of the referenced paper.

  T = (S_1.T S_2.T ... S_n.T).T
  
hand_eye_calibration/python/hand_eye_calibration/dual_quaternion_hand_eye_calibration.py