亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ezmtltest.cpp

?? 矩陣運算的模板類
?? CPP
?? 第 1 頁 / 共 3 頁
字號:
#include "../ezmtl/Matrix.h"
#ifdef _WIN32
#include <io.h> // for access()
#include <direct.h> // for mkdir()
#else
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#define _access access
#define _mkdir mkdir
#endif

template <typename T> int checkEigenVectors(Matrix<T>& A,Matrix<T>& EVec,Matrix<T>& EVal);
static int CreateDir(const char *dirName);
int main(){

	int isOK;
	{
		cout << ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n";
		cout << "CAUTION: Microsoft Visual C++ may produce different answers \n";
		cout << "         between the Release and Debug modes\n";
		cout << "         when the single precision is used.\n";
		cout << ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n";
		cout << "\n";
	}

#if 1

#if 1
	{
		Matrix<float> A;
		Vector<float> x;		x.Resize(2);		Vector<float> y(3);		x(1)=32; x(2)=15;		y(1)=3; y(2)=5; y(3)=8;
		Matrix<float> B(y,2,2);
		cout << "-----------------------------------------------------\n";
		cout << "General matrix operations\n";
		cout << "-----------------------------------------------------\n";
		B.Print(cout,"B");
		float tt=(float)Ipow(10,-5);	}
#endif

#if 1
	{
		Matrix<float> A;
		Matrix<float> B;
		Vector<float> x;
		A.Resize(2,3);
		A(1,1)=1; A(1,2)=2; A(1,3)=3; 
		A(2,1)=3; A(2,2)=5; A(2,3)=1;
		cout << "-----------------------------------------------------\n";
		cout << "Testing reshape" << endl;
		cout << "-----------------------------------------------------\n";
		A.Print(cout,"A");
		Reshape(A,3,2).Print(cout,"Reshape(A,3,2)");
	}
#endif
		
#if 1
	{
		Matrix<float> A;
		Matrix<float> B;
		Vector<float> x;
		A.Resize(2,3);
		A(1,1)=1; A(1,2)=2; A(1,3)=3; 
		A(2,1)=3; A(2,2)=5; A(2,3)=1;
		x.Resize(2);
		Vector<float> y(3);
		x(1)=32; x(2)=15;
		y(1)=3; y(2)=5; y(3)=8;
		cout << "-----------------------------------------------------\n";		cout << "Testing x\'*A*y" << endl;
		cout << "-----------------------------------------------------\n";		float z=(float)MultiplyXtAY(x,A,y);		x.Print(cout,"  x");		A.Print(cout,"  A");		y.Print(cout,"  y");		cout << "  x\'*A*y=" << z << endl << endl;
	}
#endif
#if 1
	{
		Matrix<float> A;
		Matrix<float> B;
		Vector<float> x;
		A.Resize(3,3);
		A(1,1)=3; A(1,2)=2; A(1,3)=1; 
		A(2,1)=2; A(2,2)=4; A(2,3)=2; 
		A(3,1)=1; A(3,2)=2; A(3,3)=5; 
		Matrix<float> L;
		cout << "-----------------------------------------------------\n";
		cout << "Testing Cholesky decomposition for symmetric positive definite matrices: A=L*L\'" << endl;
		cout << "-----------------------------------------------------\n";
		A.Print(cout,"  A");
		Chol(A,L);
		L.Print(cout,"  L");
		(A-L*Transpose(L)).Print(cout,"  A-L*L\'=0");
		Vector<float> b(3);
		b(1)=1; b(2)=-2; b(3)=5;
		CholSolve(A,b,x);
		b.Print(cout,"  b");
		x.Print(cout,"  x");
	}
#endif

#if 1
	{
		Matrix<float> A;
		Matrix<float> B;
		Vector<float> x;
		A.Resize(3,3);
		A(1,1)=1; A(1,2)=2; A(1,3)=3; 
		A(2,1)=4; A(2,2)=5; A(2,3)=6; 
		A(3,1)=7; A(3,2)=8; A(3,3)=0; 
		
		cout << "-----------------------------------------------------\n";
		cout << "Testing LU decomposition for square matrices: A=L*U" << endl;
		cout << "-----------------------------------------------------\n";
		A.Print(cout,"A");

		Matrix<float> L,U,P;
		// A=L*U;
		cout << "  A=L*U" << endl;
		Lu(A,L,U);
		L.Print(cout,"  L");
		U.Print(cout,"  U");
		(A-L*U).Print(cout,"  A-L*U=0");
		
		// L*U=P*A
		cout << "  P*A=L*U" << endl;
		Lu(A,L,U,P);
		L.Print(cout,"  L");
		U.Print(cout,"  U");
		P.Print(cout,"  P");
		(L*U-P*A).Print(cout,"  L*U-P*A=0");

		Vector<float> b(3);
		b(1)=1; b(2)=-2; b(3)=5;
		x.Resize(3);
		LuSolve(A,b,x);
		x.Print(cout,"  x");
	
	}
#endif

#if 1
	{
		Matrix<float> A;
		Matrix<float> B;
		Vector<float> x;
		cout << "-----------------------------------------------------\n";
		cout << "Testing Determinant" << endl;
		cout << "-----------------------------------------------------\n";
		A.Resize(3,3);
		A(1,1)=1; A(1,2)=2; A(1,3)=3; 
		A(2,1)=4; A(2,2)=5; A(2,3)=6; 
		A(3,1)=7; A(3,2)=8; A(3,3)=0;
		A.Print(cout,"A");
		cout << "  det(A)=" << Det(A) << endl << endl;
		Matrix<float> C(2,2);
		C(1,1)=1; C(1,2)=2; 
		C(2,1)=3; C(2,2)=4;
		C.Print(cout,"C");
		cout << "  det(C)=" << Det(C) << endl << endl;
	}
#endif

#if 1
	{
		Matrix<float> A;
		Matrix<float> B;
		Vector<float> x;
		cout << "-----------------------------------------------------\n";
		cout << "Testing Inverse" << endl;
		cout << "-----------------------------------------------------\n";
		A.Resize(3,3);
		A(1,1)=1; A(1,2)=2; A(1,3)=3; 
		A(2,1)=4; A(2,2)=5; A(2,3)=6; 
		A(3,1)=7; A(3,2)=8; A(3,3)=0; 
		int retCode;
		A.Print(cout,"A");
		Inv(A,&retCode).Print(cout,"Inv(A)");
	}
#endif

#if 1
	{
		Matrix<float> A;
		Matrix<float> B;
		Vector<float> x;
		Vector<float> b;
		A.Resize(3,3);
		A(1,1)=1; A(1,2)=2; A(1,3)=3; 
		A(2,1)=3; A(2,2)=5; A(2,3)=1; 
		A(3,1)=1; A(3,2)=-1; A(3,3)=0; 
		cout << "-----------------------------------------------------\n";
		cout << "Testing QR decomposition for any matrices: A=Q*R" << endl;
		cout << "-----------------------------------------------------\n";
		Matrix<float> Q,R;
		isOK=Qr(A,Q,R);
		A.Print(cout,"  A");
		Q.Print(cout,"  Q");
		R.Print(cout,"  R");
		(A-Q*R).Print(cout,"  A-QR=0");
		b.Resize(3);
		b(1)=1; b(2)=2; b(3)=3;
		QrSolve(A,b,x);
		b.Print(cout,"  b");
		x.Print(cout,"  x");

		A.Resize(2,3);
		A(1,1)=1; A(1,2)=2; A(1,3)=3;
		A(2,1)=4; A(2,2)=5; A(2,3)=6;
		isOK=Qr(A,Q,R);
		A.Print(cout,"  A");
		Q.Print(cout,"  Q");
		R.Print(cout,"  R");
		(A-Q*R).Print(cout,"  A-QR=0");
		b.Resize(2);
		b(1)=1; b(2)=2;
		QrSolve(A,b,x);
		b.Print(cout,"  b");
		x.Print(cout,"  x");

		A.Resize(3,2);
		A(1,1)=1; A(1,2)=2;
		A(2,1)=3; A(2,2)=4;
		A(3,1)=5; A(3,2)=6;
		isOK=Qr(A,Q,R);
		A.Print(cout,"  A");
		Q.Print(cout,"  Q");
		R.Print(cout,"  R");
		(A-Q*R).Print(cout,"  A-QR=0");
		b.Resize(3);
		b(1)=1; b(2)=-2; b(3)=5;
		QrSolve(A,b,x);
		b.Print(cout,"  b");
		x.Print(cout,"  x");
	}
#endif

#if 1
	{
		Matrix<float> A;
		Matrix<float> B;
		Vector<float> x;
		cout << "-----------------------------------------------------\n";
		cout << "Testing LDL factorization: A=L*D*L\'" << endl;
		cout << "-----------------------------------------------------\n";
		Matrix<float> L(3,3),D(3,3);
		A.Resize(3,3);
		A(1,1)=3; A(1,2)=2; A(1,3)=1; 
		A(2,1)=2; A(2,2)=4; A(2,3)=2; 
		A(3,1)=1; A(3,2)=2; A(3,3)=5;

		A.Print(cout,"  A");
		Ldl(A,L,D);
		L.Print(cout,"  L");
		D.Print(cout,"  D");
		(A-L*D*Transpose(L)).Print(cout,"  A-L*D*L\'=0");

		Vector<float> b;
		b.Resize(3);
		b(1)=1; b(2)=-2; b(3)=5;
		LdlSolve(A,b,x);
		b.Print(cout,"  b");
		x.Print(cout,"  x");
	}
#endif

#if 1
	{
		Matrix<float> A;
		Matrix<float> B;
		Vector<float> x;
		cout << "-----------------------------------------------------\n";
		cout << "Testing QRCP factorization: " << endl;
		cout << "-----------------------------------------------------\n";

		Matrix<float> L(3,3),D(3,3);
		A.Resize(3,3);
		A(1,1)=1; A(1,2)=2; A(1,3)=3;
		A(2,1)=4; A(2,2)=5; A(2,3)=6;
		A(3,1)=7; A(3,2)=8; A(3,3)=0;

		Matrix<float> QRCP;
		Vector<float> diag;
		Vector<int> px;

		A.Print(cout,"  A");
		Qrcp(A,QRCP,diag,px);
		QRCP.Print(cout,"  QRCP");
		diag.Print(cout,"  diag");
		px.Print(cout,"  px");

		Vector<float> b;
		b.Resize(3);
		b(1)=1; b(2)=-2; b(3)=5;
		QrcpSolve(A,b,x);
		b.Print(cout,"  b");
		x.Print(cout,"  x");
	}
#endif

#if 1
	{
		Matrix<float> A;
		Matrix<float> B;
		Vector<float> x;
		cout << "-----------------------------------------------------\n";
		cout << "Testing BKP factorization" << endl;
		cout << "-----------------------------------------------------\n";
		Matrix<float> BKP(3,3);
		Vector<int> pivot, blocks;
		A.Resize(3,3);
		A(1,1)=3; A(1,2)=2; A(1,3)=1; 
		A(2,1)=2; A(2,2)=4; A(2,3)=2; 
		A(3,1)=1; A(3,2)=2; A(3,3)=5;

		A.Print(cout,"  A");
		Bkp(A,BKP,pivot,blocks);
		BKP.Print(cout,"  BKP");
		pivot.Print(cout,"  pivot");
		blocks.Print(cout,"  blocks");

		Vector<float> b;
		b.Resize(3);
		b(1)=1; b(2)=-2; b(3)=5;
		BkpSolve(A,b,x);
		b.Print(cout,"  b");
		x.Print(cout,"  x");
	}
#endif

#if 1
	{
		Matrix<float> A;
		Matrix<float> B;
		Vector<float> x;
		Matrix<float> EVal, EVec;
		float z;
		Matrix<float> ans;
		int i;

		cout << "-----------------------------------------------------\n";
		cout << "Testing Eigen analysis by the Jacobi transformation" << endl;
		cout << "-----------------------------------------------------\n";		A.Resize(2,2);
		A(1,1)=5; A(1,2)=1;
		A(2,1)=1; A(2,2)=5;
		A.Print(cout,"  A");
		Eig(A, EVec, EVal);
		EVal.Print(cout,"  EVal");
		EVec.Print(cout,"  EVec");
		for(i=1;i<=2;i++){
			Vector<float> x=EVec.Col(i);
			z=(float)Multiply3(Transpose(x),A,x);
			cout << "  EVec(" << i << ")\'*A*Evec(" << i << ")=" << z << endl;
		}
		ans=A*EVec-EVec*EVal;
		ans.Print(cout,"  A*EVec-EVec*EVal=0");
		cout << endl;
		
		A.Resize(3,3);		A(1,1)=3; A(1,2)=2; A(1,3)=1; 		A(2,1)=2; A(2,2)=4; A(2,3)=2; 		A(3,1)=1; A(3,2)=2; A(3,3)=5; 		
		cout << "-----------------------------------------------------\n";		cout << "Testing Eigen analysis by the Householder transformation and QL algorithm" << endl;		cout << "-----------------------------------------------------\n";
		A.Print(cout,"  A");		EigHHolder(A, EVec, EVal);		EVal.Print(cout,"  EVal");		EVec.Print(cout,"  EVec");		for(i=1;i<=3;i++){			Vector<float> x=EVec.Col(i);			z=(float)Multiply3(Transpose(x),A,x);			cout << "  EVec(" << i << ")\'*A*Evec(" << i << ")=" << z << endl;		}
		ans=A*EVec-EVec*EVal;		ans.Print(cout,"  A*EVec-EVec*EVal=0");
		cout << endl;
	}
#endif	
#if 1
	{
		Matrix<float> A;
		Matrix<float> B;
		Vector<float> x;
		cout << "-----------------------------------------------------\n";
		cout << "Testing Simultaneous diagonalization: E\'*A*E=I, E\'*B*E=D" << endl;
		cout << "-----------------------------------------------------\n";		Matrix<float> E(3,3),D(3,3);
		A.Resize(3,3);
		A(1,1)=5; A(1,2)=2; A(1,3)=1; 
		A(2,1)=2; A(2,2)=5; A(2,3)=1; 
		A(3,1)=1; A(3,2)=1; A(3,3)=2; 
		B.Resize(3,3);
		B(1,1)=3; B(1,2)=2; B(1,3)=1; 
		B(2,1)=2; B(2,2)=2; B(2,3)=1; 
		B(3,1)=1; B(3,2)=1; B(3,3)=3; 
		
		A.Print(cout,"  A");
		B.Print(cout,"  B");		SimDiag(A, B, E, D);
		E.Print(cout,"  E");
		D.Print(cout,"  D");
		(Transpose(E)*A*E).Print(cout,"  E\'*A*E=I");
		(Transpose(E)*B*E).Print(cout,"  E\'*B*E=D");
	}
#endif

#if 1
	{
		Matrix<float> A;
		Matrix<float> B;
		Vector<float> x;
		cout << "-----------------------------------------------------\n";
		cout << "Testing Singular value decomposition: A=U*S*V\'" << endl;
		cout << "-----------------------------------------------------\n";
		Matrix<float> U, S, V;

		A.Resize(2,3);
		A(1,1)=1; A(1,2)=2; A(1,3)=3; 
		A(2,1)=4; A(2,2)=5; A(2,3)=6;

		Svd(A,U,S,V);
		A.Print(cout,"  A");
		U.Print(cout,"  U");
		S.Print(cout,"  S");
		V.Print(cout,"  V");
		(A-U*S*Transpose(V)).Print(cout, "  A-U*S*V\'=0");

		A.Resize(3,2);
		A(1,1)=1; A(1,2)=2;
		A(2,1)=3; A(2,2)=4;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人福利视频在线看| 成人一级黄色片| 国产精品超碰97尤物18| 欧美丝袜丝nylons| 国产成人免费在线观看| 午夜欧美电影在线观看| 国产日韩欧美在线一区| 3d动漫精品啪啪一区二区竹菊| 丰满白嫩尤物一区二区| 日本不卡免费在线视频| 国产精品久久久久三级| 337p日本欧洲亚洲大胆色噜噜| 欧美亚洲高清一区二区三区不卡| 国产不卡免费视频| 久久国产精品色| 亚洲bt欧美bt精品| 日韩毛片视频在线看| 久久久av毛片精品| 欧美一区二区视频在线观看2022| 色综合亚洲欧洲| 成人av电影在线网| 国产不卡视频一区| 国产在线精品免费| 秋霞国产午夜精品免费视频| 一级中文字幕一区二区| 欧美国产1区2区| 久久精品免费在线观看| 精品国产免费人成在线观看| 欧美精品v国产精品v日韩精品| 91麻豆国产香蕉久久精品| 福利电影一区二区三区| 九九视频精品免费| 久久99精品一区二区三区三区| 日韩av高清在线观看| 天堂va蜜桃一区二区三区| 夜夜精品视频一区二区| 亚洲精选一二三| 亚洲精品国产一区二区三区四区在线 | 亚洲国产一区二区视频| 亚洲日本在线视频观看| 中文字幕一区在线观看| 中文一区一区三区高中清不卡| 久久久久久久久久久久久夜| 337p日本欧洲亚洲大胆色噜噜| 欧美精品一区二区在线观看| xf在线a精品一区二区视频网站| 精品久久久久久久久久久久包黑料 | 在线综合亚洲欧美在线视频| 制服丝袜一区二区三区| 欧美精品粉嫩高潮一区二区| 欧美一区二区三区日韩| 日韩欧美国产综合| 久久夜色精品一区| 国产精品天干天干在观线 | 亚洲va国产天堂va久久en| 日韩一区欧美二区| 日本亚洲天堂网| 精一区二区三区| 成人自拍视频在线| 91亚洲精品久久久蜜桃| 欧美日韩一区二区电影| 911精品产国品一二三产区 | 亚洲天堂中文字幕| 亚洲电影在线播放| 麻豆精品视频在线观看| 国产麻豆日韩欧美久久| 99久久99久久精品免费观看| 欧美伦理电影网| 久久综合色播五月| 亚洲视频免费在线| 丝袜美腿成人在线| 国产成人午夜99999| 色av成人天堂桃色av| 制服丝袜亚洲播放| 国产拍欧美日韩视频二区| 亚洲一区在线观看网站| 久久99精品久久久| 91在线观看地址| 日韩一区二区三区在线| 国产精品久久三| 午夜精品一区二区三区电影天堂 | 不卡一区二区在线| 欧美另类一区二区三区| 久久老女人爱爱| 一区二区三区**美女毛片| 麻豆国产欧美日韩综合精品二区| 国产精品一区三区| 在线影院国内精品| 久久精品水蜜桃av综合天堂| 一区二区三区欧美亚洲| 韩国成人福利片在线播放| 欧美亚洲丝袜传媒另类| 欧美激情一区二区三区在线| 亚洲成av人片在www色猫咪| 高清日韩电视剧大全免费| 欧美福利电影网| 亚洲欧美怡红院| 久久99热99| 欧美视频中文字幕| 国产精品色婷婷久久58| 蜜桃一区二区三区四区| 一本大道久久精品懂色aⅴ| 国产亚洲1区2区3区| 丝袜诱惑亚洲看片| 91丨九色丨蝌蚪丨老版| ww亚洲ww在线观看国产| 日韩黄色免费网站| 色综合视频一区二区三区高清| 久久精品在线观看| 久久精品国产精品亚洲红杏| 91国产视频在线观看| 国产欧美日韩一区二区三区在线观看| 日韩影视精彩在线| 欧美三级电影精品| 亚洲女女做受ⅹxx高潮| 不卡的av网站| 国产日韩欧美精品综合| 国产美女一区二区三区| 日韩限制级电影在线观看| 亚洲一区二区三区四区在线观看| 成人免费av在线| 国产亚洲婷婷免费| 国精产品一区一区三区mba桃花| 7777精品伊人久久久大香线蕉完整版| 亚洲色图在线播放| 成人app下载| 国产精品麻豆欧美日韩ww| 粉嫩13p一区二区三区| 国产欧美日本一区视频| 国产福利91精品一区二区三区| 精品免费一区二区三区| 免费久久99精品国产| 在线不卡欧美精品一区二区三区| 亚洲国产一区二区三区| 色婷婷精品久久二区二区蜜臂av | 久久国产精品第一页| 日韩一区二区精品| 蜜臀av一级做a爰片久久| 欧美一区二区三区喷汁尤物| 日本不卡中文字幕| 日韩欧美一区二区免费| 久久av资源站| 久久综合九色综合97婷婷女人 | 麻豆专区一区二区三区四区五区| 欧美疯狂性受xxxxx喷水图片| 三级欧美在线一区| 欧美一区二区视频在线观看2022| 美洲天堂一区二卡三卡四卡视频| 日韩欧美视频一区| 韩国午夜理伦三级不卡影院| 久久婷婷国产综合精品青草| 成人h版在线观看| 亚洲欧美激情一区二区| 欧美亚洲日本一区| 美女视频第一区二区三区免费观看网站 | 精彩视频一区二区三区| 久久久久久久久久久黄色| 粉嫩一区二区三区在线看| 1024成人网色www| 欧美在线看片a免费观看| 日韩黄色免费电影| 国产欧美日韩另类一区| 91在线你懂得| 日日夜夜一区二区| 久久青草欧美一区二区三区| av男人天堂一区| 午夜影院久久久| 久久久国产综合精品女国产盗摄| 97久久精品人人爽人人爽蜜臀| 亚洲午夜视频在线| 久久―日本道色综合久久| 91一区二区在线观看| 蜜乳av一区二区三区| 国产精品萝li| 欧美日韩电影一区| 国产福利精品导航| 婷婷激情综合网| 国产视频一区二区在线| 欧美日韩美少妇| 国产裸体歌舞团一区二区| 亚洲制服丝袜av| 国产婷婷色一区二区三区在线| 在线精品视频免费观看| 精品亚洲免费视频| 亚洲伊人色欲综合网| 久久久综合精品| 欧美日韩一卡二卡三卡| 成人国产精品免费观看动漫| 日本va欧美va欧美va精品| 国产精品伦理一区二区| 欧美大片在线观看一区| 欧美中文字幕一区二区三区| 国产激情一区二区三区四区| 亚洲丶国产丶欧美一区二区三区| 久久久午夜精品| 欧美一区二区私人影院日本| 色婷婷激情综合| www.亚洲在线| 激情综合网av| 婷婷开心激情综合|