我有一个复数数组,我想用fortran的write输出成6*6矩阵,format里写什么?parameter(n=6)dimension a(n,n)complex ::aa(1,1)=(1.0,0.0)a(1,2)=(1.0,2.0)a(1,3)=(2.0,1.0)a(1,4)=(0.0,0.0)a(1,5)=(3.0,0.0)a(1,6)=(2.0,0.0)a(2,1)=(1.0,-2.0)a(2,2)=(2
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/26 11:07:21
我有一个复数数组,我想用fortran的write输出成6*6矩阵,format里写什么?parameter(n=6)dimension a(n,n)complex ::aa(1,1)=(1.0,0.0)a(1,2)=(1.0,2.0)a(1,3)=(2.0,1.0)a(1,4)=(0.0,0.0)a(1,5)=(3.0,0.0)a(1,6)=(2.0,0.0)a(2,1)=(1.0,-2.0)a(2,2)=(2
我有一个复数数组,我想用fortran的write输出成6*6矩阵,format里写什么?
parameter(n=6)
dimension a(n,n)
complex ::a
a(1,1)=(1.0,0.0)
a(1,2)=(1.0,2.0)
a(1,3)=(2.0,1.0)
a(1,4)=(0.0,0.0)
a(1,5)=(3.0,0.0)
a(1,6)=(2.0,0.0)
a(2,1)=(1.0,-2.0)
a(2,2)=(2.0,0.0)
a(2,3)=(2.0,0.0)
a(2,4)=(0.0,2.0)
a(2,5)=(0.0,0.0)
a(2,6)=(1.0,0.0)
a(3,1)=(2.0,-1.0)
a(3,2)=(2.0,0.0)
a(3,3)=(3.0,0.0)-w
a(3,4)=(0.0,3.0)
a(3,5)=(0.0,0.0)
a(3,6)=(0.0,0.0)
a(4,1)=(0.0,0.0)
a(4,2)=(0.0,-2.0)
a(4,3)=(0.0,-3.0)
a(4,4)=(0.0,0.0)
a(4,5)=(0.0,0.0)
a(4,6)=(0.0,0.0)
a(5,1)=(-3.0,0.0)
a(5,2)=(0.0,0.0)
a(5,3)=(0.0,0.0)
a(5,4)=(0.0,0.0)
a(5,5)=(0.0,0.0)
a(5,6)=(0.0,0.0)
a(6,1)=(-2.0,0.0)
a(6,2)=(-1.0,0.0)
a(6,3)=(0.0,0.0)
a(6,4)=(0.0,0.0)
a(6,5)=(0.0,0.0)
a(6,6)=(0.0,0.0)
write(*,643) ((a(i,j),j=1,n),i=1,n)
643 format(?)
我有一个复数数组,我想用fortran的write输出成6*6矩阵,format里写什么?parameter(n=6)dimension a(n,n)complex ::aa(1,1)=(1.0,0.0)a(1,2)=(1.0,2.0)a(1,3)=(2.0,1.0)a(1,4)=(0.0,0.0)a(1,5)=(3.0,0.0)a(1,6)=(2.0,0.0)a(2,1)=(1.0,-2.0)a(2,2)=(2
我从来不用format语句,如果要求不高的话可以
write(*,*) ((a(i,j),j=1,n),i=1,n)
或者
do i=1,6
write(*,*) a(i,:)
enddo
如果你对格式要求很高,那么最不济的办法可以用循环并分实部和虚部来输出,这样就全是实数了.