//!Perform traceback through trellis //!\return [out] path trackback_path void simpleTrellis::traceback(traceback_path& path,size_t n) { if (n<=ending.nth_viterbi_scores->size()) { if (ending.viti!=-INFINITY) { path.setScore((*ending.nth_viterbi_scores)[n].viterbi_score); int state_pointer=(*ending.nth_viterbi_scores)[n].traceback_state; size_t score_pointer = (*ending.nth_viterbi_scores)[n].traceback_state_score; path.push_back(state_pointer); size_t seq_length = seq->getLength(); if (seq_length==0) { return; } for(size_t position=seq_length -1 ; position>0; position--) { state_pointer = (*trell[position][state_pointer].nth_viterbi_scores)[score_pointer].traceback_state; score_pointer = (*trell[position][state_pointer].nth_viterbi_scores)[score_pointer].traceback_state_score; path.push_back(state_pointer); if (state_pointer==-2) { path.clear(); return; } } } } return; }
//!Perform traceback through trellis //!\return [out] path trackback_path void simpleTrellis::traceback(traceback_path& path) { if (ending.viti!=-INFINITY) { path.setScore(ending.viti); int pointer=ending.ptr; path.push_back(ending.ptr); size_t seq_length = seq->getLength(); if (seq_length==0) { return; } for(size_t position=seq_length -1 ; position>0; position--) { pointer=trell[position][pointer].ptr; path.push_back(pointer); if (pointer==-2) { path.clear(); return; } } } return; }