For Programmers: Free Programming Magazines  


Home > Archive > Fortran > September 2005 > What do the symbols do in the following example:









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author What do the symbols do in the following example:
jdturner

2005-09-11, 6:57 pm

Experts:

I found the following code on the WEB for inverting a matrix, but I
have not found any documentation for the function of the bracket
symbols. I would like to know what they mean, are the standard, will
they port easily, .....

Thanks,
Jim Turner

! ---------------------------
SUBROUTINE Gauss (a,n) ! Invert matrix by Gauss method
IMPLICIT NONE
INTEGER :: n
REAL(8) :: a(n,n), b(n,n), temp(n), c, d
INTEGER :: ipvt(n), j, k, m
! - - - - - - - - - - - - - -
b = a
ipvt = [ 1:n ]
DO k = 1,n
m = k-1+MAXLOC(ABS(b(k:n,k)),dim=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

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com