Re: Real Symmetric Matrix Inversion
- From: "David Frank" <dave_frank@xxxxxxxxxxx>
- Date: Thu, 20 Mar 2008 15:15:40 -0400
"rjmagyar" <rjmagyar@xxxxxxxxx> wrote in message
news:d8fc7e65-caa3-4307-8ac4-8f45f05244fa@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi, I was wondering if any one can recommend a robust and fast matrix
inversion routine. I have a matrix with vastly different (sometimes
over 10 orders of magnitude) elements that needs to be inverted. I
have modified the matinv routine by C. Reeve to allow double precision
calculations, but this doesn't seems to be enough. The inverse I get
is only approximately correct. Does any one know of either a general
routine that can handle this, or does any one know a scheme around
this?
Best, Rudy
For n < 50
below is PROVEN fastest and most accurate..
! --------------------------------------------------------------------
SUBROUTINE Gauss (a,n) ! Invert matrix by Gauss method
! --------------------------------------------------------------------
IMPLICIT NONE
INTEGER :: n
REAL(8) :: a(n,n), b(n,n), c, d, temp(n)
INTEGER :: j, k, m, imax(1), ipvt(n)
b = a
ipvt = [ 1:n ]
DO k = 1,n
imax = MAXLOC(ABS(b(k:n,k)))
m = k-1+imax(1)
IF (m /= k) THEN
ipvt( [m,k] ) = ipvt( [k,m] )
b( [m,k],:) = b( [k,m],:)
END IF
d = 1/b(k,k)
temp = b(:,k)
DO j = 1, n
c = b(k,j)*d
b(:,j) = b(:,j)-temp*c
b(k,j) = c
END DO
b(:,k) = temp*(-d)
b(k,k) = d
END DO
a(:,ipvt) = b
END SUBROUTINE Gauss
.
- Follow-Ups:
- Re: Real Symmetric Matrix Inversion
- From: Rich Townsend
- Re: Real Symmetric Matrix Inversion
- References:
- Real Symmetric Matrix Inversion
- From: rjmagyar
- Real Symmetric Matrix Inversion
- Prev by Date: Real Symmetric Matrix Inversion
- Next by Date: Re: Real Symmetric Matrix Inversion
- Previous by thread: Real Symmetric Matrix Inversion
- Next by thread: Re: Real Symmetric Matrix Inversion
- Index(es):
Relevant Pages
|