Python Matrix Inversion

Utility

The scripts on this page require the utility module tompy.py

* * *

Python Scripts

A script for calculating the inverse of a square matrix is given at: inverse_matrix.py

The script uses the function: from numpy import linalg

Here is a script which calculates the pseudo inverse of a singular matrix: pseudo_inverse_matrix.py

* * *

Fortran Program

Here is a Fortran program which performs matrix inversion using the LU decomposition method: INVERSE_MATRIX.F

It is compiled via:

gfortran -o INVERSE_MATRIX INVERSE_MATRIX.F -llapack -lblas

The program uses the subroutines: DGETRF & DGETRI

It compiles & runs under both Ubuntu & Cygwin.

* * *

See also: http://www.nag.com/numeric/fl/nagdoc_fl23/examples/source/f07ajfe.f90

Tom Irvine

Leave a comment