code: def _update_rhs(curr_rhs, xCore, zCore, new_rhs):
      
      # TODO: Use intermediate variable to use 5 nested loops instead of 6.
      r_x, n, r_old_x = xCore.shape
      num_obj, r_z, n, r_old_z = zCore.shape
      for idx in range(num_obj):
          for val in range(n):
              for alpha_old_z in range(r_old_z):
                  for alpha_z in range(r_z):
                      for alpha_old_x in range(r_old_x):
                          for alpha_x in range(r_x):
                              curr_value = curr_rhs[idx, alpha_old_z, alpha_old_x]
                              curr_value *= xCore[alpha_x, val, alpha_old_x]
                              curr_value *= zCore[idx, alpha_z, val, alpha_old_z]
                              new_rhs[idx, alpha_z, alpha_x] += curr_value
docs: Function to be called from the project()