// file: bw_debug_0.cc
//

// isip include files
//
#include "bw_train.h"
#include "bw_train_constants.h"

// method: print_prob_cc
//
// arguments:
//  FILE* fp: (input) file pointer
//  float** for_prob: (input) forward probabilities
//  float** back_prob: (input) backward probabilities
//  int_4 num_vect: (input) total number of feature vectors
//  int_4 num_mod: (input) the number of input models
//  int_4* model_list: (input) the index of each model
//  Model** models: (input) the whole model sequence
//  float_8 utt_prob: (input) the utterance probability
//  float_8* max_mback: (input) the maximum for each model at each frame
//
// dump all the probability
//
logical_1 print_prob_cc(FILE* fp_a, float_8** for_prob_a,
			float_8** back_prob_a, int_4 num_vect_a,
			int_4 num_mod_a, int_4* model_list_a,
			Train_Model** models_a, float_8 utt_prob_a,
			float_8* max_mback_a) {

  int_4 num_state = (int_4)0;

  // loop over the models
  //
  for (int_4 j = 1; j <= num_mod_a; j++) {
    if(max_mback_a[j] > BW_LOG_ZERO) {
      num_state = models_a[model_list_a[j-1]]->get_num_states_cc();

      // loop over all the state
      //
      for (int_4 k = 1; k <= num_state; k++) {
	fprintf(fp_a, "mod %ld st %ld:  %20.5f | %12.5f\n", j, k,
		for_prob_a[j][k], back_prob_a[j][k]);
      }
    }
  }

  // exit gracefully
  //
  return(ISIP_TRUE);
}
  
