?? matrixsingularvalue.cpp
字號(hào):
//MatrixSingularValue.cpp 一般實(shí)矩陣的奇異值分解
#include <iostream> //輸入輸出流
#include "Matrix.h" //矩陣類及相關(guān)函數(shù)等的定義
using namespace std; //名字空間
void main() // 定義控制臺(tái)應(yīng)用程序的入口點(diǎn)
{
double a[4][3]={ {1.0,1.0,-1.0},{2.0,1.0,0.0},
{1.0,-1.0,0.0},{-1.0,2.0,1.0}};
double b[3][4]={ {1.0,1.0,-1.0,-1.0},{2.0,1.0,0.0,2.0},
{1.0,-1.0,0.0,1.0}};
matrix<double> ma(&a[0][0], 4, 3);
matrix<double> mb(&b[0][0], 3, 4);
matrix<double> mu(4, 4), mv(3, 3), mc(4, 3), md(3, 4);
double eps(DOUBLEERROR);
int i = MatrixSingularValue(ma,mu,mv,eps);
cout << "EXAMPLE(1) " << endl;
cout << endl << "i = " << i << endl;
cout << endl << "MAT U IS: " << endl;
MatrixLinePrint(mu);
cout << endl << "MAT V IS: " << endl;
MatrixLinePrint(mv);
cout << endl << "MAT A IS: " << endl;
MatrixLinePrint(ma);
cout << endl << "MAT UAV IS: " << endl;
mc = mu * ma;
ma = mc * mv;
MatrixLinePrint(ma);
cout << endl << "EXAMPLE(2)" << endl << endl;
i = MatrixSingularValue(mb,mv,mu,eps);
cout << "i = " << i << endl << endl;
cout << "MAT U IS: " << endl;
MatrixLinePrint(mv);
cout << endl << "MAT V IS: " << endl;
MatrixLinePrint(mu);
cout << endl << "MAT B IS: " << endl;
MatrixLinePrint(mb);
cout << endl << "MAT UBV IS: " << endl;
md = mv * mb;
mb = md * mu;
MatrixLinePrint(mb);
cout << endl;
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -