void freeXHMM(xHmm *xhmm){ if (xhmm != NULL){ freeHMM(xhmm->m); freeRMat(xhmm->bss); if (xhmm->bps) freeRMat3d(xhmm->bps); free(xhmm); } }
/* HMM_initGlobals - * Given a number of states and a sequence length, allocates or reallocates * memory for internal variables. */ void HMM_initGlobals(int uu, int tt) { if (g_alpha==NULL||COLUMNS(g_alpha)<tt||ROWS(g_alpha)<uu) { if (g_alpha!=NULL) { freeRMat(g_alpha); freeRMat(g_delta); freeRMat(g_deltav); /* This could be int. */ freeRMat(g_beta); freeRMat3d(g_psi);} g_alpha = allocRMat(uu, tt); g_delta = allocRMat(uu, tt); g_deltav = allocRMat(uu, tt); /* This could be int. */ g_beta = allocRMat(uu, tt); g_psi = allocRMat3d(uu, uu, tt);}}