code: def kdot(x, y, K=2):
      
      xx = x.reshape(-1, x.shape[-1])
      yy = y.reshape(y.shape[0], -1)
  
      xx = numpy.ascontiguousarray(xx)
      yy = numpy.ascontiguousarray(yy)
  
      r = _accupy.kdot_helper(xx, yy).reshape((-1,) + x.shape[:-1] + y.shape[1:])
      return ksum(r, K - 1)
docs: Algorithm 5.10. Dot product algorithm in K-fold working precision,
      K >= 3.