?? eigenvaluevectorrealtriangleqr.cpp
字號:
//EigenvalueVectorRealTriangleQR.cpp
//實對稱三角陣全部特征值及特征向量QR法
#include <iostream> //輸入輸出流頭文件
#include "Matrix.h" //矩陣類及相關函數頭文件
#include "EigenvalueVector.h" //特征值及特征向量頭文件
using namespace std; //名字空間
void main() // 定義控制臺應用程序的入口點
{
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); //輸出數據為定點法
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;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -