算法介紹
矩陣求逆在程序中很常見,主要應用于求Billboard矩陣。按照定義的計算方法乘法運算,嚴重影響了性能。在需要大量Billboard矩陣運算時,矩陣求逆的優化能極大提高性能。這里要介紹的矩陣求逆算法稱為全選主元高斯-約旦法。
高斯-約旦法(全選主元)求逆的步驟如下:
首先,對于 k 從 0 到 n - 1 作如下幾步:
從第 k 行、第 k 列開始的右下角子陣中選取絕對值最大的元素,并記住次元素所在的行號和列號,在通過行交換和列交換將它交換到主元素位置上。這一步稱為全選主元。
m(k, k) = 1 / m(k, k)
m(k, j) = m(k, j) * m(k, k),j = 0, 1, ..., n-1;j != k
m(i, j) = m(i, j) - m(i, k) * m(k, j),i, j = 0, 1, ..., n-1;i, j != k
m(i, k) = -m(i, k) * m(k, k),i = 0, 1, ..., n-1;i != k
最后,根據在全選主元過程中所記錄的行、列交換的信息進行恢復,恢復的原則如下:在全選主元過程中,先交換的行(列)后進行恢復;原來的行(列)交換用列(行)交換來恢復。
標簽:
算法
矩陣求逆
程序
上傳時間:
2015-04-09
上傳用戶:wang5829
英文版,pdf格式。
詳細說明:
Title: STL Tutorial and Reference Guide: C++ Programming with the Standard Template Library (2nd Edition)
URL: http://www.amazon.com/exec/obidos/tg/detail/-/0201379236/
ISBN: 0201379236
Author: David R. Musser / Gillmer J. Derge / Atul Saini / Gilmer J. Derge
Publisher: Addison-Wesley
Page: 560
Edition: 2nd edition (March 27, 2001)
Catalog: C++
Format: PDF
Size: 3.8M
Supplier: December
Summary: The Standard Template Library was created as the first library of genetic algorithms and data structures, with four ideas in mind: generic programming, abstractness without loss of efficiency, the Von Neumann computation model, and value semantics. This guide provides a tutorial, a description of each element of the library, and sample applications. The expanded second edition includes new code examples and demonstrations of the use of STL in real-world C++ software development it reflects changes made to STL for the final ANSI/ISO C++ language standard.
標簽:
Programming
Reference
Standard
Tutorial
上傳時間:
2015-09-02
上傳用戶:Breathe0125