以下是直接利用行列式定義以及逆序數法計算6階行列式的fortran77程式,供參考。c 求6階行列式的值 real a(6,6),ip(6) data a/2,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0, 1 2,3,4,5,1,6,1,1,1,1,1,2/ f=0 do 10 i=1,6 do 20 j=1,6 if (j.eq.i) goto 20 do 30 k=1,6 if (k.eq.i.or.k.eq.j) goto 30 do 40 l=1,6 if (l.eq.i.or.l.eq.j.or.l.eq.k) goto 40 do 50 m=1,6 if (m.eq.i.or.m.eq.j.or.m.eq.k.or.m.eq.l) goto 50 n=21-i-j-k-l-m ip(1)=i ip(2)=j ip(3)=k ip(4)=l ip(5)=m ip(6)=n mm=0 do 1000 ii=1,5 do 1000 jj=ii+1,61000 if (ip(ii).gt.ip(jj)) mm=mm+1 if (mod(mm,2).eq.0) then sign=1 else sign=-1 endifc t=a(1,i)*a(2,j)*a(3,k)*a(4,l)*a(5,m)*a(6,n)*(-1)**mm*1.0c write(*,*)t t=sign*a(1,i)*a(2,j)*a(3,k)*a(4,l)*a(5,m)*a(6,n) f=f+t50 continue40 continue30 continue20 continue10 continue write(*,*)f end
以下是直接利用行列式定義以及逆序數法計算6階行列式的fortran77程式,供參考。c 求6階行列式的值 real a(6,6),ip(6) data a/2,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0, 1 2,3,4,5,1,6,1,1,1,1,1,2/ f=0 do 10 i=1,6 do 20 j=1,6 if (j.eq.i) goto 20 do 30 k=1,6 if (k.eq.i.or.k.eq.j) goto 30 do 40 l=1,6 if (l.eq.i.or.l.eq.j.or.l.eq.k) goto 40 do 50 m=1,6 if (m.eq.i.or.m.eq.j.or.m.eq.k.or.m.eq.l) goto 50 n=21-i-j-k-l-m ip(1)=i ip(2)=j ip(3)=k ip(4)=l ip(5)=m ip(6)=n mm=0 do 1000 ii=1,5 do 1000 jj=ii+1,61000 if (ip(ii).gt.ip(jj)) mm=mm+1 if (mod(mm,2).eq.0) then sign=1 else sign=-1 endifc t=a(1,i)*a(2,j)*a(3,k)*a(4,l)*a(5,m)*a(6,n)*(-1)**mm*1.0c write(*,*)t t=sign*a(1,i)*a(2,j)*a(3,k)*a(4,l)*a(5,m)*a(6,n) f=f+t50 continue40 continue30 continue20 continue10 continue write(*,*)f end