xHmm *allocXHMM(int uu, int ii, int tt){ assert(uu > 0 && ii > 0 && tt > 0); xHmm *xhmm = safe_malloc(sizeof *xhmm); xhmm->m = allocHMM(uu); xhmm->ii = ii; xhmm->tt = tt; if (tt > 1) xhmm->bps = allocRMat3d(tt - 1, ii, ii); else xhmm->bps = NULL; xhmm->bss = allocRMat(tt, ii); return 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);}}