PageRenderTime 14ms CodeModel.GetById 13ms app.highlight 0ms RepoModel.GetById 0ms app.codeStats 0ms

/algorithms_for_tapenade/fortran_code/dense_inverse.f

http://github.com/b45ch1/hpsc_hanoi_2009_walter
FORTRAN Legacy | 25 lines | 21 code | 3 blank | 1 comment | 0 complexity | 80de0a4491d8840de49338f8f08f9dec MD5 | raw file
 1	subroutine inv(A,QT,R,NA)
 2	implicit none
 3	integer*4 NA
 4	real*8 A(NA*NA), QT(NA*NA), R(NA*NA)
 5	integer*4 n,m,k
 6	real*8 tmp
 7	call qr(A,QT,R,NA)
 8	
 9	do n= NA-1,0,-1
10		tmp = R(n*NA + n + 1)
11		do m = 0, NA-1
12			R (n*NA + m + 1) = R (n*NA + m + 1)/ tmp
13			QT(n*NA + m + 1) = QT(n*NA + m + 1)/ tmp
14		enddo
15		do m=n+1,NA-1
16			tmp = R(n*NA + m + 1)
17			R( n*NA + m + 1) = 0
18			do k=0,NA-1
19				QT(n*NA + k + 1) = QT(n*NA + k + 1) - QT( m*NA + k + 1) * tmp
20			enddo
21		enddo
22	enddo
23	
24	end
25