This function performs kernel version of kmeans algorithm. When the linear kernel (i.e., inner product) is used, the algorithm is equivalent to standard kmeans algorithm.
K: n x n a semi-definite matrix computed by a kernel function on all sample pairs
m: the number of clusters k (1 x 1) or the initial label of samples (1 x n, 1<=label(i)<=k)
reference:  Kernel Methods for Pattern Analysis
by John Shawe-Taylor, Nello Cristianini
K=x'*x; % use linear kernel