📄 ts_state_0.cc
字号:
// file: ts_state_0.cc//// isip include files//#include "tie_state.h"#include "tie_state_constants.h" // method: read_states_cc//// arguments:// int_4& num_st : (output) number of states// int_4& num_feat : (output) number of features in data vector// char_1* file : (input) data file name// // return: a State** pointing to a list of States//// this method reads the State models from file --- each mixture// component in the states is assumed to have a diagonal covariance// matrix//State** read_states_cc(int_4& num_st_a, int_4& num_feat_a, char_1* file_a) { // open file // FILE* fp = fopen((char*)file_a, "rb"); if (fp == (FILE*)NULL) { fprintf(stdout, "cannot open file %s\n", file_a); exit(ISIP_PROTO_ERROR); } // read the number of features and number of states // fread((void_p)&num_feat_a, sizeof(int_4), 1, fp); fread((void_p)&num_st_a, sizeof(int_4), 1, fp); // initialize the states // State::set_num_features_cc(num_feat_a); State** states = (State**)NULL; states = new State*[num_st_a]; // read state data from file // for (int_4 i = 0; i < num_st_a; i++) { // create state memory // states[i] = new State(); // read the parameters for this state // states[i]->read_data_cc(fp); } // close file // fclose(fp); // exit gracefully // return states;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -