32 character(len=100):: name
33 logical LookForFilename, LookForinvDim
36 character(len=100) :: filename, output
40 integer*4 sizeAm, sizeAn
42 character(len=20) sizeInv_string
43 character(len=8) out_status
46 integer*4,
allocatable :: ia(:), ja(:)
48 COMPLEX*16,
ALLOCATABLE :: a(:)
50 REAL*8,
ALLOCATABLE :: a(:)
54 COMPLEX*16,
allocatable :: invA(:,:)
56 real*8,
allocatable :: invA(:,:)
70 lookforfilename = .false.
71 lookforinvdim = .false.
72 lookforoutput = .false.
77 narg=command_argument_count()
82 call get_command_argument(cptarg,name)
83 select case(adjustl(name))
85 write(0,*)
"This is program calculates the " , &
86 "Schur complement of a sparse matirix. Usage: ./getSchur ", &
87 "--filename FILENAME --invDim INTEGER" 89 case(
"--filename",
"-F",
"--Filename")
90 lookforfilename = .true.
91 case(
"--output",
"-o",
"--Output")
92 lookforoutput = .true.
94 lookforinvdim = .true.
96 if (lookforfilename)
then 97 filename=adjustl(name)
98 lookforfilename = .false.
99 elseif (lookforoutput)
then 101 lookforoutput = .false.
102 elseif (lookforinvdim)
then 103 sizeinv_string = trim(adjustl(name))
104 READ( sizeinv_string, * ) sizeinv
105 lookforinvdim = .false.
107 write(0,*)
"Option ",adjustl(name),
"unknown" 113 if (output.eq.
'')
then 118 write(0,*)
'Input file name:', trim(filename)
119 write(0,*)
'Output file name:', trim(output)
123 inquire(file=trim(filename),exist=fileexist)
124 if(.not.fileexist)
then 125 write(0,*)
"file ",trim(filename),
" not found!" 130 OPEN(unit=6, file=trim(filename),status=
'OLD',form=
'UNFORMATTED')
132 READ(6,end=999,err=1000) sizean
133 READ(6,end=999,err=1000) nonzerosa
135 allocate(ia(sizean+1))
136 allocate(ja(nonzerosa))
137 allocate(a(nonzerosa))
139 READ(6,end=999,err=1000) ia(:)
140 READ(6,end=999,err=1000) ja(:)
141 READ(6,end=999,err=1000) a(:)
149 write(0,*)
'Size of the partial inverse:', sizeinv
150 write(0,*)
'The size of the input MATRIX:', sizean
151 write(0,*)
'Nonzeros in the input matrix:', nonzerosa
152 write(0,*)
'The input MATRIX:' 155 if (j >= ia(i+1))
then 159 if (j < ia(i+1))
then 170 ALLOCATE(inva(sizeinv, sizeinv))
181 write(0,*)
'row', i,
'col', j,
' element of A = ', inva(i,j)
189 if (
allocated(inva) )
then 196 999
write(*,
'(/"End-of-file when i = ",I5)') i
199 1000
write(*,
'(/"ERROR reading when i = ",I5)') i
Module to calculate the partial inverse of a real/complex sparse matrix via the PARDISO libraries...
subroutine dgetpartialinv(sizeA, nonzerosA, a, ia, ja, sizeInv, invA, error)
Get the partial inverse of double valued real matrices.