Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find the inverse of a Rectangular Matrix in C using GSL

I searched on Google and I couldn't find a function to calculate the inverse of Rectangular Matrix using GSL. Being that it was hard to find, an answer here would help others when they need to find an inverse of a rectangular matrix. If it is not possible using GSL, then please suggest some alternative library which is easy to use and provides the inverse of rectangular matrix.

like image 907
Govind Agarwal Avatar asked Oct 21 '22 03:10

Govind Agarwal


1 Answers

Yes, it is possible! You probably did not fin it because it is in the chapter Linear Algebra, not Matrices.

In GSL you first compute the LU decomposition and then use it to determine the inverse via

int gsl_linalg_LU_invert (const gsl_matrix * LU, const gsl_permutation * p, gsl_matrix * inverse)

See here for a detailed example https://lists.gnu.org/archive/html/help-gsl/2008-11/msg00001.html

like image 117
Ludi Avatar answered Nov 01 '22 10:11

Ludi