// file: tr_st_cstr_0.cc
//

// isip include files
//
#include "train_state.h"
#include "train_state_constants.h"
 
// method: destructor
//
// arguments: none
//
// return: none
//
// this is the destructor for the class
//
Train_State::~Train_State() {

  // free memory in scale
  //
  if (scale_d != (float_4*)NULL) {
    delete [] scale_d;
  }
  scale_d = (float_4*)NULL;
  
  // free memory in weights
  //
  if (weights_d != (float_4*)NULL) {
    delete [] weights_d;
  }
  weights_d = (float_4*)NULL;
  
  // free memory in mean
  //
  if (mean_d != (float_4**)NULL) {
    for (int_4 i = 0; i < num_mixtures_d; i++) {
      if (mean_d[i] != (float_4*)NULL) {
        delete [] mean_d[i];
        mean_d[i] = (float_4*)NULL;
      }
    }
    delete [] mean_d;
    mean_d = (float_4**)NULL;
  }
  
  // free memory in covar
  //
  if (covar_d != (float_4**)NULL) {
    for (int_4 i = 0; i < num_mixtures_d; i++) {
      if (covar_d[i] != (float_4*)NULL) {
        delete [] covar_d[i];
        covar_d[i] = (float_4*)NULL;
      }
    }
    delete [] covar_d;
    covar_d = (float_4**)NULL;
  }

  // reset the mixture number
  //
  num_mixtures_d = TRAIN_STATE_NUM_MIXTURES;
  
  // exit gracefully
  //
}
