Пример #1
0
void
fpusave(void *addr)
{

	if (use_xsave)
		xsave((char *)addr, xsave_mask);
	else
		fxsave((char *)addr);
}
Пример #2
0
void xgamc(int index, int *nerr)
{



	/*=====================================================================
	 * PURPOSE: To execute a MOD command given its index number.
	 *=====================================================================
	 * INPUT ARGUMENTS:
	 *    INDEX:   The index number of the command.
	 *=====================================================================
	 * OUTPUT ARGUMENTS:
	 *    NERR:    Error flag. Set to 0 if no error occurred.
	 *             Potential error numbers: 0901.
	 *=====================================================================
	 * MODULE/LEVEL: GAM/1
	 *=====================================================================
	 * GLOBAL INPUT:
	 *    MACH:
	 *=====================================================================
	 * GLOBAL OUTPUT:
	 *    GAM:     LRTWXL, KRTWXL, ORTWXL
	 *=====================================================================
	 * SUBROUTINES CALLED:
	 *    SACLIB:  GTOUTM, XP, XP1, XP2, XPPK, XPC, XFID, XPICKS, XPLOTPM
	 *=====================================================================
	 * MODIFICATION HISTORY:
	 *    970204:  Added FILENUMBER to allow or disallow file number
	 *             display.  maf
	 *    890421:  Added PLOTXY command.
	 *    870728:  Moved XLIM and YLIM commands from GEM.
	 *    870420:  Added SETDEVICE command.
	 *    861203:  Added PLOTPM command.
	 *    830105:  Deleted PUSER command.
	 *    821228:  Added FILEID and PICKS commands. Deleted DISPLAY command.
	 *    821005:  Added PLOTC command.
	 *    820825:  Original version.
	 *===================================================================== */
	/* PROCEDURE: */
	*nerr = 0;

	/* - Jump to correct command based upon its index number. */

	switch( index ){
		case 1: goto L_100;
		case 2: goto L_200;
		case 3: goto L_300;
		case 4: goto L_400;
		case 5: goto L_500;
		case 6: goto L_600;
		case 7: goto L_700;
		case 8: goto L_800;
		case 9: goto L_900;
		case 10: goto L_1000;
		case 11: goto L_1100;
		case 12: goto L_1200;
		case 13: goto L_1300;
		case 14: goto L_1400;
		case 15: goto L_1500;
		case 16: goto L_1600;	/* added for FILENUMBER. maf 970204 */
		case 17: goto L_1700;	/* added for PRINT. maf 990422 */
                case 18: goto L_1800;
		}

	/* - Error return if bad index value. */

	*nerr = 901;
	setmsg( "ERROR", *nerr );
	apcmsg( "in XGAMC",9 );
	goto L_8888;

L_100:
	/* - Command 01: PLOT */
	xp( nerr );
	goto L_8888;

L_200:
	/* - Command 02: PLOT1 */
	xp1( nerr );
	goto L_8888;

L_300:
	/* - Command 03: PLOT2 */
	xp2( nerr );
	goto L_8888;

L_400:
	/* - Command 04: PLOTPK */
	xppk( nerr );
	goto L_8888;

L_500:
	/* - Command 05: PLOTC */
	xpc( nerr );
	goto L_8888;

L_600:
	/* - Command 06: FILEID */
	xfid( nerr );
	goto L_8888;

L_700:
	/* - Command 07: PICKS */
	xpicks( nerr );
	goto L_8888;

L_800:
	/* - Command 08: PLOTPM */
	xplotpm( nerr );
	goto L_8888;

L_900:
	/* - Command 09: SETDEVICE */
	xsetdevice( nerr );
	goto L_8888;

L_1000:
	/* - Command 10: XLIM */
	xcrtw( &cmgam.lrtwxl, (char*)kmgam.krtwxl,9, cmgam.ortwxl, nerr );
	goto L_8888;

L_1100:
	/* - Command 11: YLIM */
	xylim( nerr );
	goto L_8888;

L_1200:
	/* - Command 12: PLOTXY */
	xplotxy( nerr );
	goto L_8888;

L_1300:
	/* - Command 13: FITXY */
	xfitxy( nerr );
	goto L_8888;

L_1400:
	/* - Command 14: PLOTDY */
	xplotdy( nerr );
	goto L_8888;

L_1500:
	/* - Command 15: PLOTALPHA */
	xplotalpha( nerr );
	goto L_8888;

L_1600:
	/* - Command 16: FILENUMBER */
	xfilenumber ( nerr ) ;
	goto L_8888 ;

L_1700:
	/* - Command 17: PRINT */
	xprint ( nerr ) ;
	goto L_8888 ;

 L_1800:
        xsave( );
        goto L_8888;

L_8888:
	return;

} /* end of function */
Пример #3
0
int main()
{
    int i, j;

    VecDoub x(7), b(7);
    MatDoub a(7, 4);
    

    a[0][0] = 0.0000000; // arbitrary: not used
    a[0][1] = 0.0000000; // arbitrary: not used
    a[0][2] = 0.5297000;
    a[0][3] = 0.9304360;
    a[1][0] = 0.0000000; // arbitrary: not used
    a[1][1] = 0.0668422;
    a[1][2] = 0.7226600;
    a[1][3] = 0.6711490;
    a[2][0] = 0.6316350;
    a[2][1] = 0.8847070;
    a[2][2] = 0.5194160;
    a[2][3] = 0.6515190;
    a[3][0] = 0.2624530;
    a[3][1] = 0.7621980;
    a[3][2] = 0.7533560;
    a[3][3] = 0.9092080;
    a[4][0] = 0.2727100;
    a[4][1] = 0.8976560;
    a[4][2] = 0.2749070;
    a[4][3] = 0.5162920;
    a[5][0] = 0.2470390;
    a[5][1] = 0.4865170;
    a[5][2] = 0.8461670;
    a[5][3] = 0.8309650;
    a[6][0] = 0.9910370;
    a[6][1] = 0.6792960;
    a[6][2] = 0.7664950;
    a[6][3] = 0.0000000; // arbitrary: not used

    x[0]    = 0.4159990;
    x[1]    = 0.3835020;
    x[2]    = 0.3834160;
    x[3]    = 0.2377740;
    x[4]    = 0.0726859;
    x[5]    = 0.3592650;
    x[6]    = 0.0345721;

    cout << "Banded matrix [a]:" << endl;
    cout << fixed << setprecision(7);
    for (i = 0; i < a.nrows(); i++) {
        for (j = 0; j < a.ncols(); j++) {
            cout << setw(12) << a[i][j];
        }
        cout << endl;
    }
    cout << endl;

    cout << "Vector [x]:" << endl;
    for (i = 0; i < x.size(); i++) {
        cout << setw(18) << x[i] << endl;
    }
    cout << endl;

    // multiply a times x, giving b
    banmul(a, 2, 1, x, b);

    cout << "After multiplying [a] times [x] this is [b]:" << endl;

    for (i = 0; i < b.size(); i++) {
      cout << setw(18) << b[i] << endl;
    }
    cout << endl;

    //
    // First, save original value of x
    //
    VecDoub xsave(x);
    //
    // The constructor does the decomposition
    //
    Bandec banded(a, 2, 1);

    //
    // Now solve for x
    //
    banded.solve(b, x);

    cout << "After solving [a] times [x] = [b] with bandec.solve():" << endl;
    cout << "    Original     Solved" << endl 
         << "       x           x" << endl;
    for (i = 0; i < x.size(); i++) {
      cout << setw(12) << xsave[i] << setw(12) << x[i] << endl;
    }

    return 0;
}