• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ M函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中M函数的典型用法代码示例。如果您正苦于以下问题:C++ M函数的具体用法?C++ M怎么用?C++ M使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了M函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: sha256_hash_block

void sha256_hash_block(sha256_ctx *ctx, const unsigned char data[64], int perform_endian_swap)
{
	ARCH_WORD_32 A, B, C, D, E, F, G, H, tmp, W[16];
#if ARCH_LITTLE_ENDIAN
	int i;
	if (perform_endian_swap) {
		for (i = 0; i < 16; ++i)
			W[i] = JOHNSWAP(*((ARCH_WORD_32*)&(data[i<<2])));
	} else
#endif
		memcpy(W, data, 16*sizeof(ARCH_WORD_32));

	// Load state from all prior blocks (or init state)
	A = ctx->h[0];
	B = ctx->h[1];
	C = ctx->h[2];
	D = ctx->h[3];
	E = ctx->h[4];
	F = ctx->h[5];
	G = ctx->h[6];
	H = ctx->h[7];

	R(A, B, C, D, E, F, G, H, W[ 0], 0x428A2F98);
	R(H, A, B, C, D, E, F, G, W[ 1], 0x71374491);
	R(G, H, A, B, C, D, E, F, W[ 2], 0xB5C0FBCF);
	R(F, G, H, A, B, C, D, E, W[ 3], 0xE9B5DBA5);
	R(E, F, G, H, A, B, C, D, W[ 4], 0x3956C25B);
	R(D, E, F, G, H, A, B, C, W[ 5], 0x59F111F1);
	R(C, D, E, F, G, H, A, B, W[ 6], 0x923F82A4);
	R(B, C, D, E, F, G, H, A, W[ 7], 0xAB1C5ED5);
	R(A, B, C, D, E, F, G, H, W[ 8], 0xD807AA98);
	R(H, A, B, C, D, E, F, G, W[ 9], 0x12835B01);
	R(G, H, A, B, C, D, E, F, W[10], 0x243185BE);
	R(F, G, H, A, B, C, D, E, W[11], 0x550C7DC3);
	R(E, F, G, H, A, B, C, D, W[12], 0x72BE5D74);
	R(D, E, F, G, H, A, B, C, W[13], 0x80DEB1FE);
	R(C, D, E, F, G, H, A, B, W[14], 0x9BDC06A7);
	R(B, C, D, E, F, G, H, A, W[15], 0xC19BF174);
	R(A, B, C, D, E, F, G, H, M(16), 0xE49B69C1);
	R(H, A, B, C, D, E, F, G, M(17), 0xEFBE4786);
	R(G, H, A, B, C, D, E, F, M(18), 0x0FC19DC6);
	R(F, G, H, A, B, C, D, E, M(19), 0x240CA1CC);
	R(E, F, G, H, A, B, C, D, M(20), 0x2DE92C6F);
	R(D, E, F, G, H, A, B, C, M(21), 0x4A7484AA);
	R(C, D, E, F, G, H, A, B, M(22), 0x5CB0A9DC);
	R(B, C, D, E, F, G, H, A, M(23), 0x76F988DA);
	R(A, B, C, D, E, F, G, H, M(24), 0x983E5152);
	R(H, A, B, C, D, E, F, G, M(25), 0xA831C66D);
	R(G, H, A, B, C, D, E, F, M(26), 0xB00327C8);
	R(F, G, H, A, B, C, D, E, M(27), 0xBF597FC7);
	R(E, F, G, H, A, B, C, D, M(28), 0xC6E00BF3);
	R(D, E, F, G, H, A, B, C, M(29), 0xD5A79147);
	R(C, D, E, F, G, H, A, B, M(30), 0x06CA6351);
	R(B, C, D, E, F, G, H, A, M(31), 0x14292967);
	R(A, B, C, D, E, F, G, H, M(32), 0x27B70A85);
	R(H, A, B, C, D, E, F, G, M(33), 0x2E1B2138);
	R(G, H, A, B, C, D, E, F, M(34), 0x4D2C6DFC);
	R(F, G, H, A, B, C, D, E, M(35), 0x53380D13);
	R(E, F, G, H, A, B, C, D, M(36), 0x650A7354);
	R(D, E, F, G, H, A, B, C, M(37), 0x766A0ABB);
	R(C, D, E, F, G, H, A, B, M(38), 0x81C2C92E);
	R(B, C, D, E, F, G, H, A, M(39), 0x92722C85);
	R(A, B, C, D, E, F, G, H, M(40), 0xA2BFE8A1);
	R(H, A, B, C, D, E, F, G, M(41), 0xA81A664B);
	R(G, H, A, B, C, D, E, F, M(42), 0xC24B8B70);
	R(F, G, H, A, B, C, D, E, M(43), 0xC76C51A3);
	R(E, F, G, H, A, B, C, D, M(44), 0xD192E819);
	R(D, E, F, G, H, A, B, C, M(45), 0xD6990624);
	R(C, D, E, F, G, H, A, B, M(46), 0xF40E3585);
	R(B, C, D, E, F, G, H, A, M(47), 0x106AA070);
	R(A, B, C, D, E, F, G, H, M(48), 0x19A4C116);
	R(H, A, B, C, D, E, F, G, M(49), 0x1E376C08);
	R(G, H, A, B, C, D, E, F, M(50), 0x2748774C);
	R(F, G, H, A, B, C, D, E, M(51), 0x34B0BCB5);
	R(E, F, G, H, A, B, C, D, M(52), 0x391C0CB3);
	R(D, E, F, G, H, A, B, C, M(53), 0x4ED8AA4A);
	R(C, D, E, F, G, H, A, B, M(54), 0x5B9CCA4F);
	R(B, C, D, E, F, G, H, A, M(55), 0x682E6FF3);
	R(A, B, C, D, E, F, G, H, M(56), 0x748F82EE);
	R(H, A, B, C, D, E, F, G, M(57), 0x78A5636F);
	R(G, H, A, B, C, D, E, F, M(58), 0x84C87814);
	R(F, G, H, A, B, C, D, E, M(59), 0x8CC70208);
	R(E, F, G, H, A, B, C, D, M(60), 0x90BEFFFA);
	R(D, E, F, G, H, A, B, C, M(61), 0xA4506CEB);
	R(C, D, E, F, G, H, A, B, M(62), 0xBEF9A3F7);
	R(B, C, D, E, F, G, H, A, M(63), 0xC67178F2);

	// save state for usage in next block (or result if this was last block)
	ctx->h[0] += A;
	ctx->h[1] += B;
	ctx->h[2] += C;
	ctx->h[3] += D;
	ctx->h[4] += E;
	ctx->h[5] += F;
	ctx->h[6] += G;
	ctx->h[7] += H;
}
开发者ID:balidani,项目名称:JohnTheRipper,代码行数:97,代码来源:sha2.c


示例2: _mesa_transform_vector

/**
 * Transform a 4-element row vector (1x4 matrix) by a 4x4 matrix.  This
 * function is used for transforming clipping plane equations and spotlight
 * directions.
 * Mathematically,  u = v * m.
 * Input:  v - input vector
 *         m - transformation matrix
 * Output:  u - transformed vector
 */
void
_mesa_transform_vector( GLfloat u[4], const GLfloat v[4], const GLfloat m[16] )
{
   const GLfloat v0 = v[0], v1 = v[1], v2 = v[2], v3 = v[3];
#define M(row,col)  m[row + col*4]
   u[0] = v0 * M(0,0) + v1 * M(1,0) + v2 * M(2,0) + v3 * M(3,0);
   u[1] = v0 * M(0,1) + v1 * M(1,1) + v2 * M(2,1) + v3 * M(3,1);
   u[2] = v0 * M(0,2) + v1 * M(1,2) + v2 * M(2,2) + v3 * M(3,2);
   u[3] = v0 * M(0,3) + v1 * M(1,3) + v2 * M(2,3) + v3 * M(3,3);
#undef M
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:20,代码来源:m_matrix.c


示例3: _math_matrix_frustum

/**
 * Apply a perspective projection matrix.
 *
 * \param mat matrix to apply the projection.
 * \param left left clipping plane coordinate.
 * \param right right clipping plane coordinate.
 * \param bottom bottom clipping plane coordinate.
 * \param top top clipping plane coordinate.
 * \param nearval distance to the near clipping plane.
 * \param farval distance to the far clipping plane.
 *
 * Creates the projection matrix and multiplies it with \p mat, marking the
 * MAT_FLAG_PERSPECTIVE flag.
 */
void
_math_matrix_frustum( GLmatrix *mat,
		      GLfloat left, GLfloat right,
		      GLfloat bottom, GLfloat top,
		      GLfloat nearval, GLfloat farval )
{
   GLfloat x, y, a, b, c, d;
   GLfloat m[16];

   x = (2.0F*nearval) / (right-left);
   y = (2.0F*nearval) / (top-bottom);
   a = (right+left) / (right-left);
   b = (top+bottom) / (top-bottom);
   c = -(farval+nearval) / ( farval-nearval);
   d = -(2.0F*farval*nearval) / (farval-nearval);  /* error? */

#define M(row,col)  m[col*4+row]
   M(0,0) = x;     M(0,1) = 0.0F;  M(0,2) = a;      M(0,3) = 0.0F;
   M(1,0) = 0.0F;  M(1,1) = y;     M(1,2) = b;      M(1,3) = 0.0F;
   M(2,0) = 0.0F;  M(2,1) = 0.0F;  M(2,2) = c;      M(2,3) = d;
   M(3,0) = 0.0F;  M(3,1) = 0.0F;  M(3,2) = -1.0F;  M(3,3) = 0.0F;
#undef M

   matrix_multf( mat, m, MAT_FLAG_PERSPECTIVE );
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:39,代码来源:m_matrix.c


示例4: EDSRSA

void EDSRSA(char *M_fname, char *n_fname, char *e_fname, char *d_fname)
{
	std::ifstream in(M_fname);
	int *M_hash = (int*)md5(&in), i;
    BigInt M(intToChar(M_hash[3])), N(n_fname, false), E(e_fname, false), D(d_fname, false);
    M *= BigInt("10000000000"); M += BigInt(intToChar(M_hash[2]));
    M *= BigInt("10000000000"); M += BigInt(intToChar(M_hash[1]));
    M *= BigInt("10000000000"); M += BigInt(intToChar(M_hash[0]));
    BigInt Signature("1"), Encode("1");
    BigInt DegreeNet[RNet];
	DegreeNet[0] = M;
	DegreeNet[0] %= N;
	for(i = 1; i < RNet; i++)
	{
		DegreeNet[i] = DegreeNet[i-1] * DegreeNet[i-1];
		DegreeNet[i] %= N;
	}
    BigInt degreeNum[RNet];
    degreeNum[0] = BigInt("1");
	for(int i = 1; i < RNet; i++)
        degreeNum[i] = degreeNum[i-1] * BigInt("2");
    BigInt I("0");
	for(int j = RNet-1; j >= 0;)
	{
		if(D >= I + degreeNum[j])
		{
			Signature *= DegreeNet[j];
			Signature %= N;
			I += degreeNum[j];
		}
		else
			j--;
	}
	/////////////////////////////
	DegreeNet[0] = Signature;
	DegreeNet[0] %= N;
	for(i = 1; i < RNet; i++)
	{
		DegreeNet[i] = DegreeNet[i-1] * DegreeNet[i-1];
		DegreeNet[i] %= N;
	}
    I = BigInt("0");
	for(int j = RNet-1; j >= 0;)
	{
		if(E >= I + degreeNum[j])
		{
			Encode *= DegreeNet[j];
			Encode %= N;
			I += degreeNum[j];
		}
		else
			j--;
	}
	/////////////////////////////
	M.TextWrite("hash.txt");
	Signature.TextWrite("signature.txt");
	Encode.TextWrite("encode.txt");
	if( M % N == Encode)
		std::cout<<"OK\n";
	else
		std::cout<<"NOT OK\n";
}
开发者ID:Valentina-Ermolaeva-KI1102,项目名称:rsa,代码行数:62,代码来源:rsa.cpp


示例5: RGB

void CGuiToolButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
	CDC*  pdc= CDC::FromHandle(lpDrawItemStruct->hDC);
	CRect rc=lpDrawItemStruct->rcItem;
	UINT  uState=lpDrawItemStruct->itemState;
	CBrush cb;
	
	if( uState & ODS_SELECTED) //the button is pressed
	{
		if(m_StyleDisplay==GUISTYLE_2003 || m_StyleDisplay == GUISTYLE_2003MENUBTN)
				cb.CreateSolidBrush(GuiDrawLayer::m_Theme? RGB(249,200,102):GuiDrawLayer::GetRGBPressBXP());
			else
				cb.CreateSolidBrush(GuiDrawLayer::GetRGBPressBXP());

	}	
	else
		if (m_bMouserOver)
		{
			if(m_StyleDisplay==GUISTYLE_2003 || m_StyleDisplay== GUISTYLE_2003MENUBTN)
				cb.CreateSolidBrush(GuiDrawLayer::m_Theme? RGB(252,230,186):GuiDrawLayer::GetRGBFondoXP());
			else
				cb.CreateSolidBrush(GuiDrawLayer::GetRGBFondoXP());

		}
		else
		{
		
			if(m_StyleDisplay==GUISTYLE_2003)
			{
				if (m_Transparent && m_StyleDisplay )
					cb.CreateStockObject(NULL_BRUSH);
				else
				{
					CGradient M(CSize(rc.Width(),rc.Height()+1));	
					M.PrepareReverseVertTab(pdc,m_StyleDisplay);
					M.Draw(pdc,rc.left,rc.top,0,0,rc.Width(),rc.Height(),SRCCOPY);	
				}
			}
			else
				if (m_StyleDisplay== GUISTYLE_2003MENUBTN)
					cb.CreateSolidBrush(GuiDrawLayer::GetRGBColorFace(m_StyleDisplay));
				else
					cb.CreateSolidBrush(m_clColor);
			
		}
	
	if (( uState & ODS_SELECTED) || m_bMouserOver )
	{
		pdc->Draw3dRect(rc,GuiDrawLayer::GetRGBCaptionXP(),GuiDrawLayer::GetRGBCaptionXP());
		rc.DeflateRect(1,1);
		
	}
	else if(m_ScrollButton || m_bSimple)
	{
		pdc->Draw3dRect(rc,GuiDrawLayer::GetRGBColorShadow(),GuiDrawLayer::GetRGBColorShadow());
		rc.DeflateRect(1,1);
	}

	if (m_Transparent )
		pdc->FillRect(rc,&cb);


	int calculodify;
	calculodify=rc.Height()-(m_SizeImage.cy);
	calculodify/=2;
	int nHeigh=calculodify+(m_bShowDark?1:0);
	int nWidth=m_ScrollButton?rc.Width()/2 :2;
	CPoint m_point=CPoint(nWidth,nHeigh);
	
	if (m_SizeImage.cx > 2)
	{
		if(m_bMouserOver == 1 && !(uState & ODS_DISABLED) && !(uState & ODS_SELECTED) && m_bShowDark)
		{
			CPoint p(m_point.x+1,m_point.y+1);
			pdc->DrawState(p,m_SizeImage,m_Icon,DSS_MONO,CBrush (GuiDrawLayer::GetRGBColorShadow()));
			m_point.x-=1; m_point.y-=1;
		}
		pdc->DrawState (m_point, m_SizeImage,m_Icon,
					(uState==ODS_DISABLED?DSS_DISABLED:DSS_NORMAL),(CBrush*)NULL);
	}
	if (m_SizeText.cx > 2)
	{
		int nMode = pdc->SetBkMode(TRANSPARENT);
		CRect rectletra=rc;
		int nt=m_ScrollButton?0:8;
		rectletra.left+=m_SizeImage.cx+nt;
		CPoint pt=CSize(rectletra.top,rectletra.left);
		if (uState & ODS_DISABLED)
			pdc->DrawState(pt, m_SizeText, m_szText, DSS_DISABLED, TRUE, 0, (CBrush*)NULL);
		else
		{
			if(m_bMouserOver != 1) 
				pdc->SetTextColor(m_clrFont);
			pdc->DrawText(m_szText,rectletra,DT_SINGLELINE|DT_LEFT|DT_VCENTER);
		}
		pdc->SetBkMode(nMode);
	}
	
	// TODO:  Add your code to draw the specified item
}
开发者ID:ZhaoboMeng,项目名称:k-line-print,代码行数:100,代码来源:GuiToolButton.cpp


示例6: game_init

void game_init(int ai)
{
	static int once = 1;
	int x, y;
	BITMAP *tmp;
	int bc = makecol(200, 150, 50);
	
	clear_to_color(screen, makecol(0, 0, 0));
	textout_centre(screen, font, "Generating&Caching Data", SCREEN_W / 2, 0, -1);
	textout_centre(screen, font, "May take a while", SCREEN_W / 2, SCREEN_H / 2, -1);
	textout_centre(screen, font, "(about 10 minutes for first run,", SCREEN_W / 2, SCREEN_H / 2 + 20, -1);
	textout_centre(screen, font, "about 1 minute every first game,", SCREEN_W / 2, SCREEN_H / 2 + 40, -1);
	textout_centre(screen, font, "few seconds else)", SCREEN_W / 2, SCREEN_H / 2 + 60, -1);
		
	if (once) {
		once = 0;
		
		animdata[0] = load_gfx("gravburn", 48);
		animdata[1] = load_gfx("shock", 48);
		animdata[2] = load_gfx("fireball", 48);
		animdata[3] = load_gfx("wheel", 48);
		animdata[4] = load_gfx("glow", 32);
		{
			int a;
			for (a = 0; a < ANIMS; a++) {
				anim[a] = 0;
				animlen[a] = dat_length(animdata[a]);
			}
		}
		
		tower = dat[TOWER_BMP].dat;
		explosion = dat[EXPLOSION_WAV].dat;
		radiating =  dat[RADIATING_WAV].dat;
		teleport =  dat[TELEPORT_WAV].dat;
		bonus =  dat[BONUS_WAV].dat;
		nuclearegg =  dat[NUCLEAREGG_BMP].dat;
		launcher =  dat[LAUNCHER_BMP].dat;
	
		bonuspic[0] = dat[BONUS0_BMP].dat;
		bonuspic[1] = dat[BONUS1_BMP].dat;
		bonuspic[2] = dat[BONUS2_BMP].dat;
	
		map = create_bitmap(SCREEN_W, SCREEN_H);
	}

	ignore[0] = 0;
	ignore[1] = 0;	
	think[0] = 0;
	think[1] = 0;
	memorized[0] = 0;
	memorized[1] = 0;
	AI[0] = 0;
	if (ai) AI[1] = 1; else AI[1] = 0;
	power[0] = 0;
	power[1] = 0;
	bonusnum = 0;
	life[0] = 100;
	life[1] = 100;
	go = 0;
	
	turn = 0;
	
	tmp = create_bitmap_ex(32, SCREEN_W, SCREEN_H);
	draw_back(tmp);
	for (y = 0; y < 16; y++) {
		for (x = 0; x < 16; x++) {
			hills[y][x] = rnd();
		}
	}

	basex[0] = 4 * TW + TW / 2;
	basey[0] = 4 * TH + TH / 2;

	basex[1] = 12 * TW + TW / 2;
	basey[1] = 12 * TH + TH / 2;

	hills[4][4] = 1;
	hills[5][4] = 1;
	hills[5][5] = 1;
	hills[4][5] = 1;

	hills[12][12] = 1;
	hills[13][12] = 1;
	hills[13][13] = 1;
	hills[12][13] = 1;

	x = rnd() * 16;
	y = rnd() * 16;

	for (y = 0; y < MH; y++) {
		for (x = 0; x < MW; x++) {
			int c = 0;
			int t;
			float height = get_height(x, y);
			float h = 0, z = height * ZZZ;
			for (h = height, t = 0; z > 0 && t < 2; z--, h -= 1.0 / (float)ZZZ, t++) {
				int r, g, b;
				float l;
				if (h < 0.2) {
					float p = h / 0.2;
//.........这里部分代码省略.........
开发者ID:stavrossk,项目名称:EggHack,代码行数:101,代码来源:game.c


示例7: prima_one_loop_round

Bool
prima_one_loop_round( Bool wait, Bool careOfApplication)
{
   XEvent ev, next_event;
   fd_set read_set, write_set, excpt_set;
   struct timeval timeout;
   int r, i, queued_events;
   PTimerSysData timer;

   if ( guts. applicationClose) return false;

   if (( queued_events = XEventsQueued( DISP, QueuedAlready))) {
      goto FetchAndProcess;
   }
   read_set = guts.read_set;
   write_set = guts.write_set;
   excpt_set = guts.excpt_set;
   if ( guts. oldest) {
      gettimeofday( &timeout, nil);
      if ( guts. oldest-> when. tv_sec < timeout. tv_sec ||
           ( guts. oldest-> when. tv_sec == timeout. tv_sec &&
             guts. oldest-> when. tv_usec <= timeout. tv_usec)) {
         timer = guts. oldest;
         apc_timer_start( timer-> who);
         if ( timer-> who == CURSOR_TIMER) {
            prima_cursor_tick();
         } else if ( timer-> who == MENU_TIMER) {
            apc_timer_stop( MENU_TIMER);
            if ( guts. currentMenu) {
               XEvent ev;
               ev. type = MenuTimerMessage;
               prima_handle_menu_event( &ev, M(guts. currentMenu)-> w-> w, guts. currentMenu);
            }
         } else if ( timer-> who == MENU_UNFOCUS_TIMER) {
            prima_end_menu();
         } else {
            prima_simple_message( timer-> who, cmTimer, false);
         }
         gettimeofday( &timeout, nil);
      }
      if ( guts. oldest && wait) {
         if ( guts. oldest-> when. tv_sec < timeout. tv_sec) {
            timeout. tv_sec = 0;
            timeout. tv_usec = 0;
         } else {
            timeout. tv_sec = guts. oldest-> when. tv_sec - timeout. tv_sec;
            if ( guts. oldest-> when. tv_usec < timeout. tv_usec) {
               if ( timeout. tv_sec == 0) {
                  timeout. tv_sec = 0;
                  timeout. tv_usec = 0;
               } else {
                  timeout. tv_sec--;
                  timeout. tv_usec = 1000000 - (timeout. tv_usec - guts. oldest-> when. tv_usec);
               }
            } else {
               timeout. tv_usec = guts. oldest-> when. tv_usec - timeout. tv_usec;
            }
         }
         if ( timeout. tv_sec > 0 || timeout. tv_usec > 200000) {
            timeout. tv_sec = 0;
            timeout. tv_usec = 200000;
         }
      } else {
         timeout. tv_sec = 0;
         if ( wait)
            timeout. tv_usec = 200000;
         else
            timeout. tv_usec = 0;
      }
   } else {
      timeout. tv_sec = 0;
      if ( wait)
         timeout. tv_usec = 200000;
      else
         timeout. tv_usec = 0;
   }
   if (( r = select( guts.max_fd+1, &read_set, &write_set, &excpt_set, &timeout)) > 0 &&
       FD_ISSET( guts.connection, &read_set)) {
      if (( queued_events = XEventsQueued( DISP, QueuedAfterFlush)) <= 0) {
         /* just like tcl/perl tk do, to avoid an infinite loop */
         RETSIGTYPE oldHandler = signal( SIGPIPE, SIG_IGN);
         XNoOp( DISP);
         XFlush( DISP);
         (void) signal( SIGPIPE, oldHandler);
      }
FetchAndProcess:
      if ( queued_events && ( application || !careOfApplication)) {
         XNextEvent( DISP, &ev);
         XCHECKPOINT;
         queued_events--;
         while ( queued_events > 0) {
            if (!application && careOfApplication) return false;
            XNextEvent( DISP, &next_event);
            XCHECKPOINT;
            prima_handle_event( &ev, &next_event);
            guts. total_events++;
            queued_events = XEventsQueued( DISP, QueuedAlready);
            memcpy( &ev, &next_event, sizeof( XEvent));
         }
         if (!application && careOfApplication) return false;
//.........这里部分代码省略.........
开发者ID:Teslos,项目名称:Prima,代码行数:101,代码来源:apc_app.c


示例8: glOrtho

void glOrtho( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
              GLfloat near_val, GLfloat far_val )
{
    GLfloat mat[16];

    if( left == right || bottom == top || near_val == far_val )
        return;

#define M(row,col)  mat[col * 4 + row]

    M(0,0) = 2.0f / (right - left);
    M(0,1) = 0.0f;
    M(0,2) = 0.0f;
    M(0,3) = -(right + left) / (right - left);

    M(1,0) = 0.0f;
    M(1,1) = 2.0f / (top - bottom);
    M(1,2) = 0.0f;
    M(1,3) = -(top + bottom) / (top - bottom);

    M(2,0) = 0.0f;
    M(2,1) = 0.0f;
    M(2,2) = -2.0f / (far_val - near_val);
    M(2,3) = -(far_val + near_val) / (far_val - near_val);

    M(3,0) = 0.0f;
    M(3,1) = 0.0f;
    M(3,2) = 0.0f;
    M(3,3) = 1.0f;

    ur_matrixMult( matrixTop, mat, matrixTop );
}
开发者ID:0branch,项目名称:boron,代码行数:32,代码来源:es_compat.c


示例9: gl_pick_matrix

//glu pick matrix implementation borrowed from Mesa3D
glh::matrix4f gl_pick_matrix(GLfloat x, GLfloat y, GLfloat width, GLfloat height, GLint* viewport)
{
	GLfloat m[16];
	GLfloat sx, sy;
	GLfloat tx, ty;

	sx = viewport[2] / width;
	sy = viewport[3] / height;
	tx = (viewport[2] + 2.f * (viewport[0] - x)) / width;
	ty = (viewport[3] + 2.f * (viewport[1] - y)) / height;

	#define M(row,col) m[col*4+row]
	M(0,0) = sx; M(0,1) = 0.f; M(0,2) = 0.f; M(0,3) = tx;
	M(1,0) = 0.f; M(1,1) = sy; M(1,2) = 0.f; M(1,3) = ty;
	M(2,0) = 0.f; M(2,1) = 0.f; M(2,2) = 1.f; M(2,3) = 0.f;
	M(3,0) = 0.f; M(3,1) = 0.f; M(3,2) = 0.f; M(3,3) = 1.f;
	#undef M

	return glh::matrix4f(m);
}
开发者ID:djdevil1989,项目名称:Luna-Viewer,代码行数:21,代码来源:llviewercamera.cpp


示例10: draw_spiral

static cairo_time_t
draw_spiral (cairo_t *cr,
             cairo_fill_rule_t fill_rule,
             align_t align,
             close_t close,
             int width, int height, int loops)
{
    int i;
    int n=0;
    double x[MAX_SEGMENTS];
    double y[MAX_SEGMENTS];
    int step = 3;
    int side = width < height ? width : height;

    assert(5*(side/step/2+1)+2 < MAX_SEGMENTS);

#define L(x_,y_) (x[n] = (x_), y[n] = (y_), n++)
#define M(x_,y_) L(x_,y_)
#define v(t) L(x[n-1], y[n-1] + (t))
#define h(t) L(x[n-1] + (t), y[n-1])

    switch (align) {
    case PIXALIGN: M(0,0); break;
    case NONALIGN: M(0.1415926, 0.7182818); break;
    }

    while (side >= step && side >= 0) {
        v(side);
        h(side);
        v(-side);
        h(-side+step);
        v(step);
        side -= 2*step;
    }

    switch (close) {
    case RECTCLOSE: L(x[n-1],y[0]); break;
    case DIAGCLOSE: L(x[0],y[0]); break;
    }

    assert(n < MAX_SEGMENTS);

    cairo_save (cr);
    cairo_set_source_rgb (cr, 0, 0, 0);
    cairo_paint (cr);

    cairo_translate (cr, 1, 1);
    cairo_set_fill_rule (cr, fill_rule);
    cairo_set_source_rgb (cr, 1, 0, 0);

    cairo_new_path (cr);
    cairo_move_to (cr, x[0], y[0]);
    for (i = 1; i < n; i++) {
	cairo_line_to (cr, x[i], y[i]);
    }
    cairo_close_path (cr);

    cairo_perf_timer_start ();
    cairo_perf_set_thread_aware (cr, FALSE);
    while (loops--) {
	if (loops == 0)
	    cairo_perf_set_thread_aware (cr, TRUE);
        cairo_fill_preserve (cr);
    }

    cairo_perf_timer_stop ();

    cairo_restore (cr);

    return cairo_perf_timer_elapsed ();
}
开发者ID:csyuschmjuh,项目名称:apl,代码行数:71,代码来源:spiral.c


示例11: plot_freqs

static int plot_freqs(AVFilterLink *inlink, AVFrame *in)
{
    AVFilterContext *ctx = inlink->dst;
    AVFilterLink *outlink = ctx->outputs[0];
    ShowFreqsContext *s = ctx->priv;
    const int win_size = s->win_size;
    char *colors, *color, *saveptr = NULL;
    AVFrame *out;
    int ch, n;

    out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
    if (!out)
        return AVERROR(ENOMEM);

    for (n = 0; n < outlink->h; n++)
        memset(out->data[0] + out->linesize[0] * n, 0, outlink->w * 4);

    /* fill FFT input with the number of samples available */
    for (ch = 0; ch < s->nb_channels; ch++) {
        const float *p = (float *)in->extended_data[ch];

        for (n = 0; n < in->nb_samples; n++) {
            s->fft_data[ch][n].re = p[n] * s->window_func_lut[n];
            s->fft_data[ch][n].im = 0;
        }
        for (; n < win_size; n++) {
            s->fft_data[ch][n].re = 0;
            s->fft_data[ch][n].im = 0;
        }
    }

    /* run FFT on each samples set */
    for (ch = 0; ch < s->nb_channels; ch++) {
        av_fft_permute(s->fft, s->fft_data[ch]);
        av_fft_calc(s->fft, s->fft_data[ch]);
    }

#define RE(x, ch) s->fft_data[ch][x].re
#define IM(x, ch) s->fft_data[ch][x].im
#define M(a, b) (sqrt((a) * (a) + (b) * (b)))

    colors = av_strdup(s->colors);
    if (!colors) {
        av_frame_free(&out);
        return AVERROR(ENOMEM);
    }

    for (ch = 0; ch < s->nb_channels; ch++) {
        uint8_t fg[4] = { 0xff, 0xff, 0xff, 0xff };
        int prev_y = -1, f;
        double a;

        color = av_strtok(ch == 0 ? colors : NULL, " |", &saveptr);
        if (color)
            av_parse_color(fg, color, -1, ctx);

        a = av_clipd(M(RE(0, ch), 0) / s->scale, 0, 1);
        plot_freq(s, ch, a, 0, fg, &prev_y, out, outlink);

        for (f = 1; f < s->nb_freq; f++) {
            a = av_clipd(M(RE(f, ch), IM(f, ch)) / s->scale, 0, 1);

            plot_freq(s, ch, a, f, fg, &prev_y, out, outlink);
        }
    }

    av_free(colors);
    out->pts = in->pts;
    return ff_filter_frame(outlink, out);
}
开发者ID:MAXsundai,项目名称:FFmpeg,代码行数:70,代码来源:avf_showfreqs.c


示例12: ad_exit

/**
 * Description not yet available.
 * \param
 */
void laplace_approximation_calculator::generate_antithetical_rvs()
{
  // number of random vectors
  const ivector & itmp=(*num_local_re_array)(1,num_separable_calls);
  //const ivector & itmpf=(*num_local_fixed_array)(1,num_separable_calls);
  for (int i=2;i<=num_separable_calls;i++)
  {
    if (itmp(i) != itmp(i-1))
    {
      cerr << "At present can only use antithetical rv's when "
              "all separable calls are the same size" << endl;
      ad_exit(1);
    }
  }
  int n=itmp(1);
  int samplesize=num_importance_samples;

  // mesh size
  double delta=0.01;
  // maximum of distribution is near here
  double mid=sqrt(double(n-1));
  dmatrix weights(1,2*n,1,2);
  double spread=15;
  if (mid-spread<=0.001)
    spread=mid-0.1;
  double ssum=0.0;
  double x=0.0;
  double tmax=(n-1)*log(mid)-0.5*mid*mid;
  for (x=mid-spread;x<=mid+spread;x+=delta)
  {
    ssum+=exp((n-1)*log(x)-0.5*x*x-tmax);
  }
  double tsum=0;
  dvector dist(1,samplesize+1);
  dist.initialize();
  int is=0;
  int ii;
  for (x=mid-spread;x<=mid+spread;x+=delta)
  {
    tsum+=exp((n-1)*log(x)-0.5*x*x-tmax)/ssum*samplesize;
    int ns=int(tsum);
    for (ii=1;ii<=ns;ii++)
    {
      dist(++is)=x;
    }
    tsum-=ns;
  }
  if (is==samplesize-1)
  {
    dist(samplesize)=mid;
  }
  else if (is<samplesize-1)
  {
    cerr << "This can't happen" << endl;
    exit(1);
  }

  // get random numbers

  random_number_generator rng(rseed);
  if (antiepsilon)
  {
    if (allocated(*antiepsilon))
    {
      delete antiepsilon;
      antiepsilon=0;
    }
  }
  antiepsilon=new dmatrix(1,samplesize,1,n);
  dmatrix & M=*antiepsilon;
  M.fill_randn(rng);

  for (int i=1;i<=samplesize;i++)
  {
    M(i)=M(i)/norm(M(i));
  }
  int nvar=(samplesize-1)*n;
  independent_variables xx(1,nvar);
  ii=0;
  for (int i=2;i<=samplesize;i++)
  {
    for (int j=1;j<=n;j++)
    {
      xx(++ii)=M(i,j);
    }
  }

  fmmt1 fmc(nvar,5);
  //fmm fmc(nvar,5);
  fmc.noprintx=1;
  fmc.iprint=10;
  fmc.maxfn=2500;
  fmc.crit=1.e-6;

  double f;
  double fbest=1.e+50;;
//.........这里部分代码省略.........
开发者ID:fishfollower,项目名称:admb,代码行数:101,代码来源:df1b2lp8.cpp


示例13: rowsize

/**
 * Description not yet available.
 * \param
 */
imatrix laplace_approximation_calculator::check_sparse_matrix_structure(void)
{
  ivector rowsize(1,usize);
  rowsize.initialize();

  imatrix tmp(1,usize,1,usize);
  tmp.initialize();
  for (int ii=1;ii<=num_separable_calls;ii++)
  {
    if (allocated((*derindex)(ii)))
    {
      ivector   iv = sort((*derindex)(ii));
      int n=iv.indexmax();
      if (n>1)                     // so we have off diagonal elements
      {
        for (int i=1;i<=n;i++)
        {
          int row=iv(i);
          for (int j=1;j<=n;j++)
          {
            if (i != j)
            {
              int col=iv(j);
              int  foundmatch=0;
              for (int k=1;k<=rowsize(row);k++)
              {
                if (tmp(row,k)==col)
                {
                  foundmatch=1;
                  break;
                }
              }
              if (foundmatch==0)  // add a new element to tmp(row)
              {
                rowsize(row)++;
                if (rowsize(row)> tmp(row).indexmax())
                {
                  tmp(row).reallocate(2);  // double the size
                }
                tmp(row,rowsize(row))=col;
              }
            }
          }
        }
      }
    }
  }
  imatrix M(1,usize,1,rowsize);
  ofstream ofs("sparseness.info");
  ofs << "# Number of parameters" << endl;
  ofs << usize << endl;
  ofs << "# Number of off diagonal elements in each row" << endl;
  ofs << rowsize << endl;
  ofs << "# The nonempty rows of M" << endl;
  for (int i=1;i<=usize;i++)
  {
    if (rowsize(i)>0)
    {
      M(i)=sort(tmp(i)(1,rowsize(i)));
      ofs << setw(4) << M(i) << endl;
    }
  }
  return M;
}
开发者ID:fishfollower,项目名称:admb,代码行数:68,代码来源:df1b2lp8.cpp


示例14: F

  void HeatTransfer::mass_residual( bool compute_jacobian,
				    AssemblyContext& context,
				    CachedValues& /*cache*/ )
  {
#ifdef GRINS_USE_GRVY_TIMERS
    this->_timer->BeginTimer("HeatTransfer::mass_residual");
#endif

    // First we get some references to cell-specific data that
    // will be used to assemble the linear system.

    // Element Jacobian * quadrature weights for interior integration
    const std::vector<libMesh::Real> &JxW = 
      context.get_element_fe(_temp_vars.T_var())->get_JxW();

    // The shape functions at interior quadrature points.
    const std::vector<std::vector<libMesh::Real> >& phi = 
      context.get_element_fe(_temp_vars.T_var())->get_phi();

    const std::vector<libMesh::Point>& u_qpoint = 
      context.get_element_fe(this->_flow_vars.u_var())->get_xyz();

    // The number of local degrees of freedom in each variable
    const unsigned int n_T_dofs = context.get_dof_indices(_temp_vars.T_var()).size();

    // The subvectors and submatrices we need to fill:
    libMesh::DenseSubVector<libMesh::Real> &F = context.get_elem_residual(_temp_vars.T_var());

    libMesh::DenseSubMatrix<libMesh::Real> &M = context.get_elem_jacobian(_temp_vars.T_var(), _temp_vars.T_var());

    unsigned int n_qpoints = context.get_element_qrule().n_points();

    for (unsigned int qp = 0; qp != n_qpoints; ++qp)
      {
	// For the mass residual, we need to be a little careful.
	// The time integrator is handling the time-discretization
	// for us so we need to supply M(u_fixed)*u for the residual.
	// u_fixed will be given by the fixed_interior_* functions
	// while u will be given by the interior_* functions.
	libMesh::Real T_dot = context.interior_value(_temp_vars.T_var(), qp);

        const libMesh::Number r = u_qpoint[qp](0);

        libMesh::Real jac = JxW[qp];

        if( _is_axisymmetric )
          {
            jac *= r;
          }

	for (unsigned int i = 0; i != n_T_dofs; ++i)
	  {
	    F(i) += _rho*_Cp*T_dot*phi[i][qp]*jac;

	    if( compute_jacobian )
              {
                for (unsigned int j=0; j != n_T_dofs; j++)
                  {
		    // We're assuming rho, cp are constant w.r.t. T here.
                    M(i,j) += _rho*_Cp*phi[j][qp]*phi[i][qp]*jac;
                  }
              }// End of check on Jacobian
          
	  } // End of element dof loop
      
      } // End of the quadrature point loop

#ifdef GRINS_USE_GRVY_TIMERS
    this->_timer->EndTimer("HeatTransfer::mass_residual");
#endif

    return;
  }
开发者ID:SylvainPlessis,项目名称:grins,代码行数:73,代码来源:heat_transfer.C


示例15: ResInt


//.........这里部分代码省略.........
                    {
                        double f0 = L0.get(i,m,k);
                        double f1 = L1.get(i,m,k);
                        double f2 = L2.get(i,m,k);
                        double f3 = L3.get(i,m,k);
                        double f4 = L4.get(i,m,k);

                        double tmp = (dt/480.0)*((23.0+4.0*sq2)*f0 + (-13.0*sq2+64.0)*f1 
                                + (-72.0*sq2+96.0)*f2 + (-43.0*sq2+64.0)*f3
                                + (-7.0+4.0*sq2)*f4);
                        ILout.set(i,m,k,1, tmp );

                        tmp = (sq2*dt/960.0)*((-8.0-15.0*sq2)*f0 + 146.0*f1
                                + 144.0*f2 - 34.0*f3 
                                + (-8.0+15.0*sq2)*f4);
                        ILout.set(i,m,k,2, tmp );

                        tmp = (sq2*dt/960.0)*((-8.0+15.0*sq2)*f0 - 34.0*f1 
                                + 144.0*f2 + 146.0*f3 
                                + (-8.0-15.0*sq2)*f4);
                        ILout.set(i,m,k,3, tmp );

                        tmp = (dt/480.0)*((-7.0+4.0*sq2)*f0 + (-43.0*sq2+64.0)*f1 
                                + (-72.0*sq2+96.0)*f2 + (-13.0*sq2+64.0)*f3
                                + (23.0+4.0*sq2)*f4);
                        ILout.set(i,m,k,4, tmp );
                    }

            break;

        case 6:

            // integrate the right hand side for each subinterval:
            dTensor2 M(6,5);

            M.set(1,1, 19.0/288.0);
            M.set(1,2, -3.0/800.0);
            M.set(1,3, 11.0/7200.0);
            M.set(1,4, -11.0/7200.0);
            M.set(1,5,    3.0/800.0); 
            M.set(2,1, 1427.0/7200.0);
            M.set(2,2, 637.0/7200.0);
            M.set(2,3, -31.0/2400.0);
            M.set(2,4, 77.0/7200.0);
            M.set(2,5, -173.0/7200.0); 
            M.set(3,1, -133.0/1200.0);
            M.set(3,2, 511.0/3600.0);
            M.set(3,3, 401.0/3600.0);
            M.set(3,4, -43.0/1200.0);
            M.set(3,5, 241.0/3600.0);
            M.set(4,1, 241.0/3600.0);
            M.set(4,2, -43.0/1200.0);
            M.set(4,3, 401.0/3600.0);
            M.set(4,4, 511.0/3600.0);
            M.set(4,5, -133.0/1200.0); 
            M.set(5,1, -173.0/7200.0);
            M.set(5,2, 77.0/7200.0);
            M.set(5,3, -31.0/2400.0);
            M.set(5,4, 637.0/7200.0);
            M.set(5,5, 1427.0/7200.0); 
            M.set(6,1, 3.0/800.0);
            M.set(6,2, -11.0/7200.0);
            M.set(6,3, 11.0/7200.0);
            M.set(6,4, -3.0/800.0);
            M.set(6,5, 19.0/288.0);
开发者ID:smoe1,项目名称:ImplicitExplicit,代码行数:66,代码来源:ResInt.cpp


示例16: deflat

    void deflat(T& M, const Interface& i, double coef) 
    {
        // deflate the Matrix
        for (Interface::const_iterator omit=i.begin();omit!=i.end();++omit) {
            for (Mesh::const_vertex_iterator vit1=omit->mesh().vertex_begin();vit1!=omit->mesh().vertex_end();++vit1) {
                #pragma omp parallel for
                #ifndef OPENMP_3_0
                for (int i2=vit1-omit->mesh().vertex_begin();i2<omit->mesh().vertex_size();++i2) {
                    const Mesh::const_vertex_iterator vit2 = omit->mesh().vertex_begin()+i2;
                #else
                for (Mesh::const_vertex_iterator vit2=vit1;vit2<omit->mesh().vertex_end();++vit2) {
                #endif
                    M((*vit1)->index(),(*vit2)->index()) += coef;
                }
            }
        }
    }

    void assemble_HM(const Geometry& geo, SymMatrix& mat, const unsigned gauss_order) 
    {
        mat = SymMatrix((geo.size()-geo.outermost_interface().nb_triangles()));
        mat.set(0.0);
        double K = 1.0 / (4.0 * M_PI);

        // We iterate over the meshes (or pair of domains) to fill the lower half of the HeadMat (since its symmetry)
        for ( Geometry::const_iterator mit1 = geo.begin(); mit1 != geo.end(); ++mit1) {

            for ( Geometry::const_iterator mit2 = geo.begin(); (mit2 != (mit1+1)); ++mit2) {

                // if mit1 and mit2 communicate, i.e they are used for the definition of a common domain
                const int orientation = geo.oriented(*mit1, *mit2); // equals  0, if they don't have any domains in common
                                                                       // equals  1, if they are both oriented toward the same domain
                                                                       // equals -1, if they are not

                if ( orientation != 0 ) {

                    double Scoeff =   orientation * geo.sigma_inv(*mit1, *mit2) * K;
                    double Dcoeff = - orientation * geo.indicator(*mit1, *mit2) * K;
                    double Ncoeff;

                    if ( !(mit1->outermost() || mit2->outermost()) ) {
                        // Computing S block first because it's needed for the corresponding N block
                        operatorS(*mit1, *mit2, mat, Scoeff, gauss_order);
                        Ncoeff = geo.sigma(*mit1, *mit2)/geo.sigma_inv(*mit1, *mit2);
                    } else {
                        Ncoeff = orientation * geo.sigma(*mit1, *mit2) * K;
                    }

                    if ( !mit1->outermost() ) {
                        // Computing D block
                        operatorD(*mit1, *mit2, mat, Dcoeff, gauss_order,false);
                    }
                    if ( ( *mit1 != *mit2 ) && ( !mit2->outermost() ) ) {
                        // Computing D* block
                        operatorD(*mit1, *mit2, mat, Dcoeff, gauss_order, true);
                    }

                    // Computing N block
                    operatorN(*mit1, *mit2, mat, Ncoeff, gauss_order);
                }
            }
        }

        // Deflate the diagonal block (N33) of 'mat' : (in order to have a zero-mean potential for the outermost interface)
        const Interface i = geo.outermost_interface();
        unsigned i_first = (*i.begin()->mesh().vertex_begin())->index();
        deflat(mat, i, mat(i_first, i_first) / (geo.outermost_interface().nb_vertices()));
    }
开发者ID:bburle,项目名称:openmeeg,代码行数:68,代码来源:assembleHeadMat.cpp


示例17: G

	G(GAME_EndWar, 224)
#endif
#if TERA
	G(GAME_Tera, 568)
#endif
#if HUNTED
	G(GAME_Hunted, 708)						// real version is 709, which is incorrect
#endif
#if DND
	G(GAME_DND, 673)						// real version is 674
#endif
	G(GAME_GoWJ, 828)						// real version is 846

	// Unreal engine 4
#if UNREAL4
	M(0), M(1), M(2), M(3), M(4), M(5)
#endif
};

#undef G
#undef M


void FArchive::OverrideVersion()
{
	int OldVer  = ArVer;
	int OldLVer = ArLicenseeVer;

	for (int i = 0; i < ARRAY_COUNT(ue4versions); i++)
	{
		if (ue4versions[i].GameTag == Game)
开发者ID:whztt07,项目名称:UModel,代码行数:31,代码来源:GameDatabase.cpp


示例18: C

} keypad[PADKEYS] = {
			{'y', 'Y', C('y')},		/* 7 */
			{'k', 'K', C('k')},		/* 8 */
			{'u', 'U', C('u')},		/* 9 */
			{'m', C('p'), C('p')},		/* - */
			{'h', 'H', C('h')},		/* 4 */
			{'g', 'g', 'g'},		/* 5 */
			{'l', 'L', C('l')},		/* 6 */
			{'p', 'P', C('p')},		/* + */
			{'b', 'B', C('b')},		/* 1 */
			{'j', 'J', C('j')},		/* 2 */
			{'n', 'N', C('n')},		/* 3 */
			{'i', 'I', C('i')},		/* Ins */
			{'.', ':', ':'}			/* Del */
}, numpad[PADKEYS] = {
			{'7', M('7'), '7'},		/* 7 */
			{'8', M('8'), '8'},		/* 8 */
			{'9', M('9'), '9'},		/* 9 */
			{'m', C('p'), C('p')},		/* - */
			{'4', M('4'), '4'},		/* 4 */
			{'g', 'G', 'g'},		/* 5 */
			{'6', M('6'), '6'},		/* 6 */
			{'p', 'P', C('p')},		/* + */
			{'1', M('1'), '1'},		/* 1 */
			{'2', M('2'), '2'},		/* 2 */
			{'3', M('3'), '3'},		/* 3 */
			{'i', 'I', C('i')},		/* Ins */
			{'.', ':', ':'}			/* Del */
};

/*
开发者ID:Agyar,项目名称:NetHack,代码行数:31,代码来源:os2.c


示例19: X

DoubleVector RowDoubleMatrix::preconditionedConjugateGradient(const DoubleVector &B, double epsilon, unsigned int niter, bool printMessages, unsigned int messageStep) const
{
    DoubleVector X(size_, 0.0); // начальное приближение - вектор нулей
    DoubleVector resid(size_); // невязка
    DoubleVector M(size_); // предусловие
    DoubleVector Z(size_);
    DoubleVector P(size_);
    DoubleVector temp(size_); // ременное хранилище
    double resid_norm;
    for (size_type i = 0; i < size_; i++)
    {
        for (size_type j = 0; j < row_size_[i]; j++)
        {
            ColumnValuePair pair = data_[i][j];
            if (pair.column == i)
            {
                M[i] = 1.0 / pair.value;
            }
        }
    }
    residual(X, B, resid);
    resid_norm = resid.norm_2();
    if (printMessages)
    {
        std::cout << "Метод сопряженных градиентов для решения предобусловленной СЛАУ" << std::endl;
        std::cout << "Начальная невязка: " << resid_norm << std::endl;
    }
    if (resid_norm > epsilon)
    {
        double ha;
        Z = M.dotProduct( resid ); // z_0
        P = Z; // p_0
        ha = (resid * Z);
        for (unsigned int i = 0; i < niter; i++)
        {
            double alpha;
            double beta;
            double hanew;

            product(P, temp);

            alpha = ha / (P * temp);
            X += alpha * P;
            resid -= alpha * temp;
            resid_norm = resid.norm_2();
            if (resid_norm <= epsilon)
            {
                if (printMessages)
                    std::cout < 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ M2M_ERR函数代码示例发布时间:2022-05-30
下一篇:
C++ LzmaDecode函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap