Fast matrix inversion algorithm
no vote
//Matrix inversion is very common in 3D programs, which is mainly used to find the billboard matrix. According to the defined calculation method, multiplication operation seriously affects the performance. When a large number of billboard matrix operations are needed, the optimization of matrix inversion can greatly improve the performance. The matrix inversion algorithm to be introduced here is called Gauss Jordan method with all selected principal components. //&The steps of Gauss Jordan inversion are as follows: / / & nbsp; / / first, for K from 0 to N - 1, we do the following steps: / / & nbsp; / / select the element with the largest absolute value from the lower right-hand submatrix starting from the k-th row and k-th column, remember the row number and column number of the secondary element, and exchange it to the position of the primary element through row exchange and column exchange. This step is called selecting all principal components. // 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 / / finally, according to the row and column exchange information recorded in the process of selecting all primary elements, the recovery principle is as follows: in the process of selecting all primary elements, the exchanged row (column) is restored first, and the original row (column) exchange is restored by column (row) exchange. //&Nbsp; / / implementation (4th order matrix)