docs: def _kshape(x, k):
      """
      >>> from numpy.random import seed; seed(0)
      >>> _kshape(np.array([[1,2,3,4], [0,1,2,3], [-1,1,-1,1], [1,2,2,3]]), 2)
      (array([0, 0, 1, 0]), array([[-1.2244258 , -0.35015476,  0.52411628,  1.05046429],
             [-0.8660254 ,  0.8660254 , -0.8660254 ,  0.8660254 ]]))
      """
      m = x.shape[0]
      idx = randint(0, k, size=m)
      centroids = np.zeros((k, x.shape[1]))
      distances = np.empty((m, k))
  
      for _ in range(100):
          old_idx = idx
          for j in range(k):
              centroids[j] = _extract_shape(idx, x, j, centroids[j])
  
          distances = (1 - _ncc_c_3dim(x, centroids).max(axis=2)).T
  
          idx = distances.argmin(1)
          if np.array_equal(old_idx, idx):
              break
  
      return idx, centroids