function c = ckm ( dim, n, p, w, k )

%% CKM carries out the continuous K-Means algorithm.
%

%
%  Initialize the cluster centers.
%
  c = ckmeans_initialize ( dim, n, p, k );
%
%  Repeatedly update clusters and centers til no change.
%
  v = -1;
  while ( 1 )

    c_old = c;
    c = ckmeans_update_centers ( dim, n, p, w, k, c_old );

    v_old = v;
    v = ckmeans_variance ( dim, n, p, w, k, c, ptoc );

    if ( v == v_old )
      break
    end

  end

  return
end

  
