fortran求找错program dsdimplicit nonereal(8) ::a(2,2)data a/1,3
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/11/05 22:00:43
fortran求找错
program dsd
implicit none
real(8) ::a(2,2)
data a/1,3,2,4/
call brinv(a,2)
print*,a
end program dsd
subroutine brinv(a,n)
dimension a(n,n),is(n),js(n)
double precision a,t,d
l=1
do 100 k=1,n
d=0.0
do 10 i=k,n
do 10 j=k,n
if(abs(a(i,j)).gt.d) then
d=abs(a(i,j))
is(k)=i
is(K)=j
end if
10 continue
if(d+1.0.eq.1.0) then
l=0
write(*,20)
return
end if
20 format(1x,'err**not inv')
do 30 j=1,n
t=a(k,j)
a(k,j)=a(is(k),j)
a(is(k),j)=t
30 continue
do 40 i=1,n
t=a(i,k)
a(i,k)=a(i,js(k))
a(i,js(k))=t
40 continue
a(k,k)=1/a(k,k)
do 50 j=1,n
if(j.ne.k)then
a(k,j)=a(k,j)*a(k,k)
end if
50 continue
do 70 i=1,n
if(i.ne.k)then
do 60 j=1,n
if(j.ne.k)then
a(i,j)=a(i,j)-a(i,k)*a(k,j)
end if
60 continue
end if
70 continue
do 80 i=1,n
if(i.ne.k)then
a(i,k)=-a(i,k)*a(k,k)
end if
80 continue
100 continue
do 130 k=n,1,-1
do 110 j=1,n
t=a(k,j)
a(k,j)=a(js(k),j)
a(js(k),j)=t
110 continue
do 120 i=1,n
t=a(i,k)
a(i,k)=a(i,is(k))
a(i,is(k))=t
120 continue
130 continue
return
end
program dsd
implicit none
real(8) ::a(2,2)
data a/1,3,2,4/
call brinv(a,2)
print*,a
end program dsd
subroutine brinv(a,n)
dimension a(n,n),is(n),js(n)
double precision a,t,d
l=1
do 100 k=1,n
d=0.0
do 10 i=k,n
do 10 j=k,n
if(abs(a(i,j)).gt.d) then
d=abs(a(i,j))
is(k)=i
is(K)=j
end if
10 continue
if(d+1.0.eq.1.0) then
l=0
write(*,20)
return
end if
20 format(1x,'err**not inv')
do 30 j=1,n
t=a(k,j)
a(k,j)=a(is(k),j)
a(is(k),j)=t
30 continue
do 40 i=1,n
t=a(i,k)
a(i,k)=a(i,js(k))
a(i,js(k))=t
40 continue
a(k,k)=1/a(k,k)
do 50 j=1,n
if(j.ne.k)then
a(k,j)=a(k,j)*a(k,k)
end if
50 continue
do 70 i=1,n
if(i.ne.k)then
do 60 j=1,n
if(j.ne.k)then
a(i,j)=a(i,j)-a(i,k)*a(k,j)
end if
60 continue
end if
70 continue
do 80 i=1,n
if(i.ne.k)then
a(i,k)=-a(i,k)*a(k,k)
end if
80 continue
100 continue
do 130 k=n,1,-1
do 110 j=1,n
t=a(k,j)
a(k,j)=a(js(k),j)
a(js(k),j)=t
110 continue
do 120 i=1,n
t=a(i,k)
a(i,k)=a(i,is(k))
a(i,is(k))=t
120 continue
130 continue
return
end
不知道你这程序是干什么的
但感觉你里边的一个 is(K)=j 应该改成 js(K)=j
改了后可以运行
但感觉你里边的一个 is(K)=j 应该改成 js(K)=j
改了后可以运行
fortran求找错program dsdimplicit nonereal(8) ::a(2,2)data a/1,3
怎样用fortran实现一个数乘以一个矩阵?real a,b(2,2) 求a*b.
DATA SEGMENT A DB -1,3,2,-2 B DW 5,2,1 DATA ENDS ... LEA BX.
fortran 找错program eepreal::u1,u0,n,Ei(5),sum,x(5)integer::ma
fortran中的real::A(N,N)=reshape((/1,2,1,3,2,3,2,3,4/),(/N,N/))
fortran题矩阵program ddcparameter(M=5,N=5)integer i,jreal:A(M,N
求问fortran里面 WRITE(*,'(A,$)')这句话是什么意思?
1、 Take a walk pass the park on Center Street. 找错 2、I Know M
英语句子找错,1 DON't be worry!There is still a little time lift.2
关于LINGO程序lingo程序如下:sets:a/1..5/:x; endsets data:x=1,2,3,4,5;
编一个程序,使放在data及data+1单元的两个8位带符号数相乘,乘积放在data+2及data+3单元中(高位在后)
已知struct sk{int a;float b;}data[2],*p;若有p=data,则以下对data[0]中成