?? eigenvaluevectorrealtriangleqr.cpp
字號(hào):
//EigenvalueVectorRealTriangleQR.cpp
//實(shí)對(duì)稱三角陣全部特征值及特征向量QR法
#include <iostream> //輸入輸出流頭文件
#include "Matrix.h" //矩陣類及相關(guān)函數(shù)頭文件
#include "EigenvalueVector.h" //特征值及特征向量頭文件
using namespace std; //名字空間
void main() // 定義控制臺(tái)應(yīng)用程序的入口點(diǎn)
{
double a[5][5] =
{
{10.0, 1.0, 2.0, 3.0, 4.0},
{ 1.0, 9.0, -1.0, 2.0, -3.0},
{ 2.0, -1.0, 7.0, 3.0, -5.0},
{ 3.0, 2.0, 3.0, 12.0, -1.0},
{ 4.0, -3.0, -5.0, -1.0, 15.0}
};
valarray<double> b(5), c(5);
matrix<double> q(5,5), da(&a[0][0],5,5);
double eps = FLOATERROR;
cout.setf(ios::fixed); //輸出數(shù)據(jù)為定點(diǎn)法
cout.precision(6); //精度6位
HouseholderTransform(da,q,b,c);
int k = EigenvalueVectorRealTriangleQR(b,c,q,eps,60);
cout << "MATRIX A IS: " << endl;
MatrixLinePrint(da);
cout << endl;
if(k>0)
{
cout << "MATRIX B IS: " << endl;
ValarrayPrint(b);
cout << endl;
cout << "MATRIX Q IS: " << endl;
MatrixLinePrint(q);
cout << endl;
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -