Ejemplo n.º 1
0
ind_cat() {
    int c;
    register char        *i /* Also used as integer */, *p;
    register struct dir2 *pd;
    char                 *pe;
    int j;
#define ii (int)i
#define iii(x)  (i=(char*)(x))

    dpp(0,0);  dpo(es);                            /* выдача заголовка */

    if( !mhead and nalt!=0 )  {dpp(0,y_head); dpo('*');}

    if( !thead ) {                                 /* дата */
        dpp( xsize-18, y_head );
        ind_date( time(0) );
#ifdef BSD
        {                                          /* загрузка системы */
            int svec[3];
            dpp( xsize-5, y_head+1 );
            gldav(svec);
            dps( conv(svec[0]>>8,2,10,' ') );  dpo('.');
            dps10((svec[0]&0xff)/26,0);
        }
#endif
    }
Ejemplo n.º 2
0
void structSteepestDescentMinimizer :: v_minimize () {
	autoNUMvector<double> dp (1, nParameters);
	autoNUMvector<double> dpp (1, nParameters);
	double fret = func (object, p);
	while (iteration < maxNumOfIterations) {
		dfunc (object, p, dp.peek());
		for (long i = 1; i <= nParameters; i++) {
			dpp[i] = - eta * dp[i] + momentum * dpp[i];
			p[i] += dpp[i];
		}
		history[++iteration] = minimum = func (object, p);
		success = 2.0 * fabs (fret - minimum) < tolerance * (fabs (fret) + fabs (minimum));
		if (after) {
			try {
				after (this, aclosure);
			} catch (MelderError) {
				Melder_casual ("Interrupted after %ld iterations.", iteration);
				Melder_clearError ();
				break;
			}
		}
		if (success) {
			break;
		}
		fret = minimum;
	}
}
Ejemplo n.º 3
0
Archivo: main.c Proyecto: stqism/DEMOS
main()
{
    register char c;
    register int fd, lgt;
    char buf[512+1];

    ini_mem();
    if( ini_screen() < 0 )  exit( 0 );
    dpo( увт );

    if( (fd=open("/usr/minihelp/dtest",0)) > 0 ) {
        while( read(fd,buf,512) > 0 ) {buf[lgt]=0;  dpc( buf );}
        close( fd );
    }

    state = 0;  radr=0177776;  wadr=0177776;

    dpp( xr, yr-1 ); dpc( " READ" );
    dpp( xr, yr );   dpo( '(' );  dpc( conv( radr, 6, 8, '0' ) );
    dpc( ")=" );     dpc( conv( get(radr), 6, 8, '0' ) );

    dpp( xw, yw-1 ); dpc( " WRITE" );
    dpp( xw, yw );   dpo( '(' );  dpc( conv( wadr, 6, 8, '0' ) );
    dpc( ")=" );     dpc( conv( wvalue, 6, 8, '0' ) );

    dpp( x=xr+1, y=yr );

    for(;;) {
        switch( state ) {
            case 0:  c = getnumb( &radr, x-xr-1, 0177777, 0160000 ); break;
            case 1:  c = getnumb( &wadr, x-xw-1, 0177777, 0160000 ); break;
            case 2:  c = getnumb(&wvalue,x-xw-9, 0177777, 0000000 ); break;
        }
rep:    switch( c ) {
            case CTRL(D):               end_screen();      exit(0);
            case 'r':  case 'R':        state=0;  x=xr+1;  dpp(x,y); break;
            case 'w':  case 'W':        state=1;  x=xw+1;  dpp(x,y); break;
            case 'v':  case 'V':        state=2;  x=xw+9;  dpp(x,y); break;
            case 'c':  case 'C':
                if( state ) {
                    wcycle = !wcycle;
                    dpp(xw+8,yw-1);  dpc( wcycle ? "(CYCLE)" : "       " );
                } else {
                    rcycle = !rcycle;
                    dpp(xr+8,yr-1);  dpc( rcycle ? "(CYCLE)" : "       " );
                }
                dpp( x, y );
                break;
            case CR:
                switch( state ) {
                    case 0:
                        rvalue = get( radr );
                        dpp( xr+9, yr );  dpc( conv(rvalue,6,8,'0') );
                        c='r';  goto rep;
                    case 1:
                        c='v';  goto rep;
                    case 2:
                        set( wadr, wvalue );
                        c='v';  goto rep;
                }
        }
    }
}