Function LU_invert (o2scl_linalg)¶
-
template<class mat_t, class mat2_t, class mat_col_t>
int o2scl_linalg::LU_invert(const size_t N, const mat_t &LU, const o2scl::permutation &p, mat2_t &inverse)¶ Compute the inverse of a matrix from its LU decomposition.
These functions compute the inverse of a matrix A from its LU decomposition (LU,p), storing the result in the matrix
inverse
. The inverse is computed by solving the system A x = b for each column of the identity matrix. It is preferable to avoid direct use of the inverse whenever possible, as the linear solver functions can obtain the same result more efficiently and reliably.- Idea for Future:
Could rewrite to avoid mat_col_t, (9/16/09 - However, the function may be faster if mat_col_t is left in, so it’s unclear what’s best.)