function [centers, ulabel] = mdist_learn(gdata, glabel)
% learn a minimum-distance classifier
% input : trainng data (DxN) and training labels
% output: class centers (DxJ) and their corresponding labels (Jx1)
%
% 2008-04-21, xlx@ee.columbia.edu

[d, n1] = size(gdata);
ulabel = unique(glabel);
un = length(ulabel);

centers = zeros(d, un);
for i = 1 : un
    ii = (glabel == ulabel(i));
    centers(:, i) = mean(gdata(:, ii), 2);
end