lvq1 
 Purpose 
 Trains codebook with the LVQ1 -algorithm (described below).
 Syntax 
  sM = lvq1(sM, D, rlen, alpha)
 Description 
 Trains codebook with the LVQ1 -algorithm. Codebook contains a number
 of vectors (mi, i=1,2,...,n) and so does data (vectors xj,
 j=1,2,...,k).  Both vector sets are classified: vectors may have a
 class (classes are set to the first column of data or map -structs'
 .labels -field). For each xj there is defined the nearest codebook
 -vector index c by searching the minimum of the euclidean distances
 between the current xj and codebook -vectors:
    c = min{ ||xj - mi|| },  i=[1,..,n], for fixed xj
         i
 If xj and mc belong to the same class, mc is updated as follows:
    mc(t+1) = mc(t) + alpha * (xj(t) - mc(t))
 If xj and mc belong to different classes, mc is updated as follows:
    mc(t+1) = mc(t) - alpha * (xj(t) - mc(t))
 Otherwise updating is not performed.
 Argument 'rlen' tells how many times training sequence is performed.
 LVQ1 -algorithm may be stopped after a number of steps, that is
 30-50 times the number of codebook vectors.
 Argument 'alpha' is the learning rate, recommended to be smaller
 than 0.1.
 NOTE: does not take mask into account.
 References 
 Kohonen, T., "Self-Organizing Map", 2nd ed., Springer-Verlag, 
    Berlin, 1995, pp. 176-179.
 See also LVQ_PAK from http://www.cis.hut.fi/research/som_lvq_pak.shtml
 Required input arguments 
  sM                The data to be trained.
          (struct)  A map struct.
  D                 The data to use in training.
          (struct)  A data struct.
  rlen    (integer) Running length of LVQ1 -algorithm.
  alpha   (float)   Learning rate used in training.
 Output arguments 
  codebook          Trained data.
          (struct)  A map struct.
 Example 
   lab = unique(sD.labels(:,1));         % different classes
   mu = length(lab)*5;                   % 5 prototypes for each    
   sM = som_randinit(sD,'msize',[mu 1]); % initial prototypes
   sM.labels = [lab;lab;lab;lab;lab];    % their classes
   sM = lvq1(sM,sD,50*mu,0.05);          % use LVQ1 to adjust
                                         % the prototypes      
   sM = lvq3(sM,sD,50*mu,0.05,0.2,0.3);  % then use LVQ3 
 See also