Re: Real Symmetric Matrix Inversion
- From: Rich Townsend <rhdt@xxxxxxxxxxxxxxxxxxx>
- Date: Fri, 21 Mar 2008 10:10:47 -0400
David Frank wrote:
"rjmagyar" <rjmagyar@xxxxxxxxx> wrote in message news:d8fc7e65-caa3-4307-8ac4-8f45f05244fa@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxHi, 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..
For a 1x1 matrix, your claim above is demonstrably false. I imagine there are other holes in your claim.
.
! --------------------------------------------------------------------
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: Richard Maine
- Re: Real Symmetric Matrix Inversion
- References:
- Real Symmetric Matrix Inversion
- From: rjmagyar
- Re: Real Symmetric Matrix Inversion
- From: David Frank
- Real Symmetric Matrix Inversion
- Prev by Date: Re: copy behavior of a fortran array as input argument
- Next by Date: Re: how can I use C allocated memory in fortran ?
- Previous by thread: Re: Real Symmetric Matrix Inversion
- Next by thread: Re: Real Symmetric Matrix Inversion
- Index(es):
Relevant Pages
|