// file: st_cstr_2.cc
//

// isip include files
//
#include "state.h"
#include "state_constants.h"
 
// method: constructor
//
// arguments:
//  int_4 num_mix : (input) number of mixtures
//  float_4* weights : (input) mixture weights
//  float_4* scale : (input) Gaussian scale factors
//  float_4** mean : (input) mean vectors
//  float_4** covar : (input) covariance matrices
//
// return: none
//
// this is the data constructor for the class
//
State::State(int_4 num_mix_a, float_4* weights_a, float_4* scale_a,
	     float_4** mean_a, float_4** covar_a) {
  
  // set the number of mixtures
  //
  num_mixtures_d = num_mix_a;

  // allocate memory for mixture weights and copy data
  //
  weights_d = new float_4[num_mixtures_d];
  memcpy(weights_d, weights_a, num_mixtures_d * sizeof(float_4));
  
  // allocate memory for scale factors and copy data
  //
  scale_d = new float_4[num_mixtures_d];
  memcpy(scale_d, scale_a, num_mixtures_d * sizeof(float_4));
  
  // allocate memory for mean vectors and copy data
  //
  mean_d = new float_4*[num_mixtures_d];
  for (int_4 i = 0; i < num_mixtures_d; i++) {
    mean_d[i] = new float_4[num_features_d];
    memcpy(mean_d[i], mean_a[i], num_features_d * sizeof(float_4));
  }
  
  // allocate memory for covar matrices and copy data
  //
  covar_d = new float_4*[num_mixtures_d];
  for (int_4 i = 0; i < num_mixtures_d; i++) {
    covar_d[i] = new float_4[num_features_d];
    memcpy(covar_d[i], covar_a[i], num_features_d * sizeof(float_4));
  }

  // initialize the frame and score
  //
  frame_d = (int_4)-1;
  score_d = STATE_SCORE;
    
  // exit gracefully
  //
}
