// file: $isip/class/stat/GaussianModel/gaus_09.cc
// version: $Id: gaus_09.cc 8972 2003-01-11 15:51:19Z jelinek $
//

// isip include files
//
#include "GaussianModel.h"

// method: adapt
//
// arguments:
//  const Vector<VectorFloat>& transform: (input) transformation matrix
//
// return: a boolean value indicating status
//
// this method transform the model using the input transformation matrix
//
boolean GaussianModel::adapt(const Vector<VectorFloat>& transform_a) {
  
  // get the number of features
  //
  long num_feat = mean_d.length();

  // form the extended mean vector
  //
  VectorFloat emean(num_feat + 1);
  for (long i = num_feat; i > 0; i--) {
    emean(i) = mean_d(i - 1);
  }
  emean(0) = 1;

  // compute transformed mean vector
  //
  VectorFloat out_mean(num_feat);
  for (long i = 0; i < num_feat; i++) {
    out_mean(i) = transform_a(i).dotProduct(emean);
  }

  // set the new mean vector
  //
  setMean(out_mean);

  // exit gracefully
  //
  return true;  
}
