?? matrixtoeplitzinversiontrench.cpp
字號:
//MatrixToeplitzInversionTrench.cpp 特蘭持(Trench)法求托伯利茲(Toeplitz)矩陣逆
#include <iostream> //輸入輸出流
#include "Matrix.h" //矩陣類及相關函數等的定義
using namespace std; //名字空間
void main() // 定義控制臺應用程序的入口點
{
const double t[6] = {10.0, 5.0, 4.0, 3.0, 2.0, 1.0};
const double tuo[6] = { 0.0,-1.0,-2.0,-3.0,-4.0,-5.0};
valarray<double> vt(t,6), vtuo(tuo,6);
const double dma[6][6] =
{
{10.0, 5.0, 4.0, 3.0, 2.0, 1.0},
{-1.0,10.0, 5.0, 4.0, 3.0, 2.0},
{-2.0,-1.0,10.0, 5.0, 4.0, 3.0},
{-3.0,-2.0,-1.0,10.0, 5.0, 4.0},
{-4.0,-3.0,-2.0,-1.0,10.0, 5.0},
{-5.0,-4.0,-3.0,-2.0,-1.0,10.0}
};
matrix<double> matT(&dma[0][0], 6, 6);
matrix<double> matB(matT); //用matT初始化matB
cout << "matT : " << endl;
MatrixLinePrint(matT); //按行輸出矩陣matT
cout << endl << "matB = Inversion(matT) : " << endl;
if(MatrixToeplitzInversionTrench(vt, vtuo, matB)>0) //現在matB是matT的逆
MatrixLinePrint(matB); //按行輸出矩陣matB
cout << endl << "matI = matT * matB : " << endl;
matrix<double> matI(matT * matB); //matT * matB得到單位陣matI
MatrixLinePrint(matI); //按行輸出矩陣matI
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -