Exemplo n.º 1
0
void srhand(register int j)
{				/* Pointer to optab[] entry   *//* * * * * * * * * *  START OF srhand()  * * * * * * * * * */

    char *a;
    register int k;

    objini(j);

    FETCH(k);

    if ((k & 0x38) == 0x30) {
	badseq(j, k);
	return;
    }

    printf("%s", OPFAM[((k & 0x38) >> 3) + 16]);

    if (!(j & 1))
	putchar('b');

    a = mtrans((j & 0xfd), (k & 0xc7), TR_STD);

    mtrunc(a);

    printf("\t%s", a);

    if (j & 2)
	printf(",cl\n");
    else
	printf(",*1\n");

    objout();

}				/* * * * * * * * * * * END OF srhand() * * * * * * * * * * */
Exemplo n.º 2
0
void pohand(register int j)
{				/* Pointer to optab[] entry   *//* * * * * * * * * *  START OF pohand()  * * * * * * * * * */

    char *a;
    register int k;

    objini(j);

    FETCH(k);

    if (k & 0x38) {
	badseq(j, k);
	return;
    }

    printf("%s\t", optab[j].text);

    a = mtrans((j & 0xfd), k, TR_STD);

    mtrunc(a);

    printf("%s\n", a);

    objout();

}				/* * * * * * * * * * * END OF pohand() * * * * * * * * * * */
Exemplo n.º 3
0
 void HMM::Estep(int iseq,
                 double* phi, double* c, double* beta, double* post,
                 double* N, double* Naux1, double* Naux2,
                 double* M, double* NU, double* loglik) {
     
     int si = o->sind[iseq];    // start index of the current sequence
     int sl = o->slen[iseq];    // sequence length
     uint32_t* y_ = o->y + si;  // pointer to the current sequence
     
     filter(iseq, phi, c, Naux1);
     smoother(iseq, c, beta, Naux1);
     
     vmul(phi, 1, beta, 1, post, 1, hs * sl);
     
     // beta[:, 1:] = beta[:, 1:]*g[:, np.int_(y[1:])]/np.tile(c[1:], [k, 1])
     for(int t = 1; t < sl; t++) {
         double* slice = beta + t*hs;
         vmul(slice, 1, g + y_[t], os, slice, 1, hs);
         vsdiv(slice, 1, c + t, slice, 1, hs);
     }
     
     // a = np.dot(phi[:, 0:-1], beta[:, 1:])
     double* A = phi;
     double* B = beta + hs;
     double* C = Naux1;
     cblas_dgemm(CblasColMajor, CblasNoTrans, CblasTrans, hs, hs, sl-1, 1, A, hs, B, hs, 0, C, hs);
     
     // a = np.transpose(a) * Q
     double* D = Naux2;
     mtrans(C, 1, D, 1, hs, hs);
     
     vmul(D, 1, Q, 1, D, 1, hs * hs);
     
     // N += a
     vadd(N, 1, D, 1, N, 1, hs*hs);
     
     // for each t, update only the col y_[t], with the expected number of states
     for(int t = 0; t < sl; t++) {
         vadd(M + y_[t], os, post + t*hs, 1, M + y_[t], os, hs);
     }
     
     // accumulate the expected number of states at t=0
     vadd(NU, 1, post, 1, NU, 1, hs);
     
     // loglik (destructive for c)
     double loglik_;
     vlog(c, c, &sl);
     sve(c, 1, &loglik_, sl);
     *loglik += loglik_;
 }
Exemplo n.º 4
0
void mmhand(register int j)
{				/* Pointer to optab[] entry   *//* * * * * * * * * *  START OF mmhand()  * * * * * * * * * */

    char b[80];
    char *a;
    register int k;

    objini(j);

    FETCH(k);

    if (k & 0x38) {
	badseq(j, k);
	return;
    }

    printf("%s", optab[j].text);

    if (!(j & 1))
	putchar('b');

    a = mtrans((j & 0xfd), (k & 0xc7), TR_STD);

    mtrunc(a);

    printf("\t%s,", a);

    if (j & 1) {
	FETCH(j);
	FETCH(k);
	k = (k << 8) | j;
	if (lookext((long) (k), (PC - 1), b))
	    printf("#%s\n", b);
	else {
	    if (k < 100 || k > 65436)
		printf("#%d\n", (short) k);
	    else
		printf("#$%04x\n", k);
	}
    } else {
	FETCH(k);
	printf("*%d\n", k);
    }

    objout();

}				/* * * * * * * * * * * END OF mmhand() * * * * * * * * * * */
Exemplo n.º 5
0
void aohand(register int j)
{				/* Pointer to optab[] entry   *//* * * * * * * * * *  START OF aohand()  * * * * * * * * * */
    char b[80];
    register int k;
    int m, n;

    objini(j);

    switch (j & 7) {
    case 0:
    case 1:
    case 2:
    case 3:
	printf("%s\t", optab[j].text);
	FETCH(k);
	printf("%s\n", mtrans(j, k, TR_STD));
	break;
    case 4:
	FETCH(k);
	if (k < 16)
	    printf("%s\tal,*%d\n", optab[j].text, k);
	else
	    printf("%s\tal,*$%02.2x\n", optab[j].text, k);
	break;
    case 5:
	FETCH(m);
	FETCH(n);
	k = (n << 8) | m;
	if (lookext((long) (k), (PC - 1), b))
	    printf("%s\tax,#%s\n", optab[j].text, b);
	else {
	    if (k < 100 || k > 65436)
		printf("%s\tax,#%d\n", optab[j].text, (short) k);
	    else
		printf("%s\tax,#$%04x\n", optab[j].text, k);
	}
	break;
    default:
	dfhand(j);
	break;
    }

    objout();

}				/* * * * * * * * * * * END OF aohand() * * * * * * * * * * */
Exemplo n.º 6
0
void mshand(register int j)
{				/* Pointer to optab[] entry   *//* * * * * * * * * *  START OF mshand()  * * * * * * * * * */

    register int k;

    objini(j);

    FETCH(k);

    if (k & 0x20) {
	badseq(j, k);
	return;
    }

    printf("%s\t%s\n", optab[j].text, mtrans(j, k, TR_SEG));

    objout();

}				/* * * * * * * * * * * END OF mshand() * * * * * * * * * * */
Exemplo n.º 7
0
void mvhand(register int j)
{				/* Pointer to optab[] entry   *//* * * * * * * * * *  START OF mvhand()  * * * * * * * * * */

    register int k, m = j;

    objini(j);

    FETCH(k);

    if ((m == 0x84) || (m == 0x85)	/* Kind of kludgey   */
	||(m == 0xc4) || (m == 0xc5)
	|| (m == 0x8d))
	if (m & 0x40)
	    m |= 0x03;
	else
	    m |= 0x02;

    printf("%s\t%s\n", optab[j].text, mtrans(m, k, TR_STD));

    objout();

}				/* * * * * * * * * * * END OF mvhand() * * * * * * * * * * */
Exemplo n.º 8
0
void mjhand(register int j)
{				/* Pointer to optab[] entry   *//* * * * * * * * * *  START OF mjhand()  * * * * * * * * * */

    char *a;
    register int k;

    objini(j);

    FETCH(k);

    a = mtrans((j & 0xfd), (k & 0xc7), TR_STD);

    mtrunc(a);

    switch (((k = objbuf[1]) & 0x38) >> 3) {
    case 0:
	printf("\tinc");
	if (!(j & 1))
	    putchar('b');
	putchar('\t');
	break;
    case 1:
	printf("\tdec");
	if (!(j & 1))
	    putchar('b');
	putchar('\t');
	break;
    case 2:
	if (j & 1)
	    printf("\tcall\t@");
	else
	    goto BAD;
	break;
    case 3:
	if (j & 1)
	    printf("\tcalli\t@");
	else
	    goto BAD;
	break;
    case 4:
	if (j & 1)
	    printf("\tjmp\t@");
	else
	    goto BAD;
	break;
    case 5:
	if (j & 1)
	    printf("\tjmpi\t@");
	else
	    goto BAD;
	break;
    case 6:
	if (j & 1)
	    printf("\tpush\t");
	else
	    goto BAD;
	break;
    case 7:
      BAD:
	badseq(j, k);
	return;
    }

    printf("%s\n", a);

    objout();

}				/* * * * * * * * * * * END OF mjhand() * * * * * * * * * * */
Exemplo n.º 9
0
void mahand(register int j)
{				/* Pointer to optab[] entry   *//* * * * * * * * * *  START OF mahand()  * * * * * * * * * */

    char *a;
    register int k;
    char b[80];

    objini(j);

    FETCH(k);

    a = mtrans((j & 0xfd), (k & 0xc7), TR_STD);

    mtrunc(a);

    switch (((k = objbuf[1]) & 0x38) >> 3) {
    case 0:
	printf("\ttest");
	break;
    case 1:
	badseq(j, k);
	return;
    case 2:
	printf("\tnot");
	break;
    case 3:
	printf("\tneg");
	break;
    case 4:
	printf("\tmul");
	break;
    case 5:
	printf("\timul");
	break;
    case 6:
	printf("\tdiv");
	break;
    case 7:
	printf("\tidiv");
	break;
    }

    if (!(j & 1))
	putchar('b');

    printf("\t%s", a);

    if (k & 0x38)
	putchar('\n');
    else if (j & 1) {
	FETCH(j);
	FETCH(k);
	k = (k << 8) | j;
	if (lookext((long) (k), (PC - 1), b))
	    printf(",#%s\n", b);
	else
	    printf(",#$%04x\n", k);
    } else {
	FETCH(k);
	printf(",*%d\n", k);
    }

    objout();

}				/* * * * * * * * * * * END OF mahand() * * * * * * * * * * */