void freeXHMM(xHmm *xhmm){ if (xhmm != NULL){ freeHMM(xhmm->m); freeRMat(xhmm->bss); if (xhmm->bps) freeRMat3d(xhmm->bps); free(xhmm); } }
void copyHMM(Hmm *m1, Hmm *m2) { int u; if(m1->uu != m2->uu){ freeHMM(m1); m1 = allocHMM(m2->uu); } copyRVec(VECTOR(m1->logB), VECTOR(m2->logB), m1->uu); for (u = 0; u<m1->uu; u++) { copyRVec(MATRIX(m1->logA)[u], MATRIX(m2->logA)[u], m1->uu);} }
void copyHMM(Hmm *m1, Hmm *m2) { int u; //assert(m1->uu>=m2->uu); /* Take into account the elimination of unreachable states */ if(m1->uu != m2->uu){ freeHMM(m1); m1 = allocHMM(m2->uu); } copyRVec(VECTOR(m1->logB), VECTOR(m2->logB), m1->uu); for (u = 0; u<m1->uu; u++) { copyRVec(MATRIX(m1->logA)[u], MATRIX(m2->logA)[u], m1->uu);} }
void freeModel(Model *m) { int u; freeHMM(m->hmm); for (u = 0; u<m->uu; u++) freeFFM(m->ffm[u]); free(m);}