主题:请问各位,怎么定义一个复数矩阵,每个矩阵元是一个小函数。要把子程序的结果代入主程序中
COMPLEX*8 BR(4,4)
COMPLEX*8 BL(4,4)
call sub()
data BL/(0.0,0.0),(0.0,-0.5*PL),(h1,0.5*NL),(-0.5*NL,0.0),&
(0.0,0.5*PL),(0.0,0.0),(-0.5*NL,0.0),(h1,-0.5*NL),&
(-h1,-0.5*NL),(0.5*NL,0.0),(0.0,0.0),(0.0,-0.5*PL),&
(0.5*NL,0.0),(-h1,0.5*NL),(0.0,0.5*PL),(0.0,0.0)/
data BR/(0.0,0.0),(0.0,-0.5*PR),(h2,0.5*NR),(-0.5*NR,0.0),&
(0.0,0.5*PR),(0.0,0.0),(-0.5*NR,0.0),(h2,-0.5*NR),&
(-h2,-0.5*NR),(0.5*NR,0.0),(0.0,0.0),(0.0,-0.5*PR),&
(0.5*NR,0.0),(-h2,0.5*NR),(0.0,0.5*PR),(0.0,0.0)/
subroutine sub()
INTEGER GL1,GR1,TL,TR
real h1,h2,e
REAL*8 GL2,GR2,PL,NL,PR,NR
e=2.71828
h1=1.5
h2=1.5
GL1=1.0
GR1=1.0
TL=10
TR=5.0
GL2=GL1*(e**(-2.0*h1/TL))
GR2=GR1*(e**(-2.0*h2/TR))
pL=GL2+GL1
NL=GL2-GL1
PR=GR2+GR1
NR=GR2-GR1
write(*,'(1x,F6.3)') PL
write(*,'(1x,F6.3)') NL
write(*,'(1x,F6.3)') PR
write(*,'(1x,F6.3)') NR
stop
end
endsubroutine sub
COMPLEX*8 BL(4,4)
call sub()
data BL/(0.0,0.0),(0.0,-0.5*PL),(h1,0.5*NL),(-0.5*NL,0.0),&
(0.0,0.5*PL),(0.0,0.0),(-0.5*NL,0.0),(h1,-0.5*NL),&
(-h1,-0.5*NL),(0.5*NL,0.0),(0.0,0.0),(0.0,-0.5*PL),&
(0.5*NL,0.0),(-h1,0.5*NL),(0.0,0.5*PL),(0.0,0.0)/
data BR/(0.0,0.0),(0.0,-0.5*PR),(h2,0.5*NR),(-0.5*NR,0.0),&
(0.0,0.5*PR),(0.0,0.0),(-0.5*NR,0.0),(h2,-0.5*NR),&
(-h2,-0.5*NR),(0.5*NR,0.0),(0.0,0.0),(0.0,-0.5*PR),&
(0.5*NR,0.0),(-h2,0.5*NR),(0.0,0.5*PR),(0.0,0.0)/
subroutine sub()
INTEGER GL1,GR1,TL,TR
real h1,h2,e
REAL*8 GL2,GR2,PL,NL,PR,NR
e=2.71828
h1=1.5
h2=1.5
GL1=1.0
GR1=1.0
TL=10
TR=5.0
GL2=GL1*(e**(-2.0*h1/TL))
GR2=GR1*(e**(-2.0*h2/TR))
pL=GL2+GL1
NL=GL2-GL1
PR=GR2+GR1
NR=GR2-GR1
write(*,'(1x,F6.3)') PL
write(*,'(1x,F6.3)') NL
write(*,'(1x,F6.3)') PR
write(*,'(1x,F6.3)') NR
stop
end
endsubroutine sub