The following dynamic array contains a non-symmetric n*n matrix (with n <=100):
int **matrix;
matrix = new int*[n];
for (int i = 0; i < n; i++)
matrix[i] = new int[n];
Is there an extremely easy way to invert it? Ideally I'd only use something from the STL or download a single header file.
Using Eigen.
http://eigen.tuxfamily.org/index.php?title=Main_Page
You can map your array to an Eigen matrix and then perform efficient matrix inversion.
You must only include it.
I add that usually if you have to perform your inversion for linear system solving, it's better to use a matrix decomposition based on the properties of the matrix that you can exploit.
不是很容易,但它的工作原理:第48页的数字配方 ,使用LU分解。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.