Hello,
I would like to read a complex matrix (see the input data below) in
Fortran 77 running on AIX. Following is my program:
------------------------begin program----------
Implicit none
complex*16 A(8,8), ap(10), aux(12,12)
real*8 w(4)
integer i, j, n, iopt, ldz, naux, k ,nmax
open(1,file='input2.txt')
open(2,file='test1005.out')
n=4
nmax=8
if (n.le.nmax) then
read(1,*)((A(i,j),j=1,4),i=1,4)
do 10 i=1,4
write(2,*)(A(i,j),j=1,4)
10 continue
c find the solution using the LAPACK routine ZHPEV
c iopt=20
c ldz=1
c naux=12
c k = 0
c do 1 j=1,n
c do 2 i=1,j
c k = k+1
c ap(k)=A(i,j)
c 2 continue
c 1 continue
c call ZHPEV(iopt,ap,w,n,aux,naux)
c do 20 i=1,4
c write(2,*)w(i)
c20 continue
endif
stop
end
--------------------end program------------------------------------
Upon compilation, it provides following error message : 1525-043 The
list-directed or NAMELIST READ statement cannot be completed because
the input data in the file input2.txt did not specify a valid complex
value. The program will recover by discontinuing further processing
of the READ statement.
--------------------begin input2.txt-----------
(3.0, 0.0) (1.0, 0.0) (0.0, 0.0) (0.0, 2.0)
(1.0, 0.0) (3.0, 0.0) (0.0,-2,0) (0.0, 0.0)
(0.0,-2.0) (0.0, 2.0) (1.0, 0.0) (1.0, 0.0)
(0.0,-2,0) (0.0, 0.0) (1.0, 0.0) (1.0, 0.0)
--------------------end input2.txt------------------
My objective is to read a complex matrix in Fortran. In my data set
the first element is the real part and the second element is the
imaginary part in each cell. I can change the input data format if
needed, for Fortran to understand it. Please let me know if you have
any clarifying question. |