24小时热门版块排行榜    

CyRhmU.jpeg
查看: 427  |  回复: 1

zhanwentao

铜虫 (初入文坛)

[求助] 麻烦各位解释一下这个Fortran程序

c     input the parameter and initiate array
      write(*,*) 'input the parameters:'
      write(*,*) 'ps,u,thrham,LT:'
      read (*,*)  ps,u,thrham,LT
        print *,  ps,u,thrham,LT
        print *,'number=',N ,'    2K=',2*k
        pt=1
        pr=1
       
        do j2=0,M
        mdensity(j2)=0
          mvnum(j2)=0
          mavn(j2)=0
          mr(j2)=0
      enddo      

      do jp=1,njp
        print *,jp
        iseed=13251*jp
        useed=ustart(iseed)

10    do i=1,N
        do j=1,NK
         link(i,j)=0
        enddo
      enddo
      do i=1,N
       nlink(i)=2*K
      enddo

c     construct N vertice and 2K nearest neighbour edges regular network
      do i=1,N
         do j=1,k
          if((i+j).gt.n) then
           link(i,j)=i+j-n
          else
           link(i,j)=i+j
          endif
         enddo
         do j=k+1,(2*k)
          if((i+k-j).le.0) then
           link(i,j)=i+k-j+n
          else
           link(i,j)=i+k-j
          endif
         enddo
      enddo         

c     construct the probability ps small world network
      do i=1,N
          do j=1,K
            p=uni()
            if(p.lt.ps) then
20           lc=nint(uni()*(n-1))+1
             do j1=1,nlink(i)
              if(link(i,j1).eq.lc) goto 20
             enddo            
             nlink(lc)=nlink(lc)+1
             if(nlink(lc).gt.NK) then
              goto 10
             endif
             link(lc,nlink(lc))=i
             link(i,j)=0
            endif
          enddo
      enddo

c     save the num of nearest neighbour of the i vertice
        do i=1,N
          j1=0
          do j=1,Nlink(i)      
             if(link(i,j).gt.0)  then               
                j1=j1+1
                link(i,j1)=link(i,j)
             endif
            enddo
          nlink(i)=j1
        enddo

c        sum the num(i) to check the program
        nlink(0)=0
          do i=1,N
          nlink(0)=nlink(0)+nlink(i)
          enddo        
        if(nlink(0).ne.(2*N*K))  then          
           print *,'return to debug the program!'
        endif
        do i=1,N
         if(nlink(i).le.0) then
           print *,'reconstruct the network!'         
           goto 10
         endif
        enddo
回复此楼
相信自己,只能靠自己
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

seaso

金虫 (正式写手)

【答案】应助回帖

感谢参与,应助指数 +1
输入参数和初始化

[ 发自手机版 http://muchong.com/3g ]
2楼2012-02-20 19:44:18
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 zhanwentao 的主题更新
信息提示
请填处理意见