爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 1383|回复: 5

[源代码] error LNK2001: unresolved external symbol _WAVE_SIGNIF@76

[复制链接]

新浪微博达人勋

发表于 2016-10-13 09:46:55 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
小波分出现下列错误是怎么回事呢
wave.obj : error LNK2001: unresolved external symbol _WAVE_SIGNIF@76
wave.obj : error LNK2001: unresolved external symbol _WAVELET@52
wave.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
wave.exe - 3 error(s), 0 warning(s)






程序如下:
PROGRAM wavetest
      IMPLICIT none
      INTEGER n,jtot
      DOUBLE PRECISION dt,s0,dj
      PARAMETER (n=155,dt=1.0D0,s0=dt/4.)
      parameter (dj=0.25)
       PARAMETER (jtot=30)

      INTEGER mother,ibase2,npad
      DOUBLE PRECISION sst(n),recon_sst(n),param,pi
      DOUBLE PRECISION scale(jtot),period(jtot),coi(n)
      DOUBLE COMPLEX wave(n,jtot)
      INTEGER i,j,isigtest,javg1,javg2
      DOUBLE PRECISION lag1,siglvl,dof(jtot)
      DOUBLE PRECISION fft_theor(jtot),signif(jtot),ymean,variance
      DOUBLE PRECISION recon_mean,recon_vari
      DOUBLE PRECISION Cdelta,psi0
      DOUBLE PRECISION global_ws(jtot),global_signif(jtot)
      DOUBLE PRECISION savg_dof(jtot),savg_signif(jtot)
DOUBLE PRECISION savg_sst(n),savg_ws(n)
      integer nm,m,na
      double precision tr(6,100)
      print*,'nm=2'
      read*,nm
      print*,nm
      open(11,file='waliguan.txt')
      do i=1,n
      read(11,*)na,(tr(m,i),m=1,2)
      enddo
      do i=1,n
      sst(i)=tr(nm,i)
      enddo
      close(11)

      pi = 4.D0*ATAN(1.D0)
      ibase2 = NINT(LOG(DBLE(n))/LOG(2.D0))+1
      npad = INT(2.D0**ibase2)
      mother = 2
      param = 2

      CALL WAVELET(n,sst,dt,mother,param,s0,dj,jtot,npad,
     &     wave,scale,period,coi)


      isigtest = 0
      lag1 = 0.72D0
      siglvl = 0.05D0
      CALL WAVE_SIGNIF (isigtest,n,sst,dt,mother,param,dj,jtot,
     &      scale,period,lag1,siglvl,dof,fft_theor,signif,
     &      ymean,variance,Cdelta,psi0)

      isigtest = 1
      siglvl = 0.05D0
      DO 10 j=1,jtot
DO 20 i=1,n
   global_ws(j) = global_ws(j) + ABS(wave(i,j))**2
20 CONTINUE
global_ws(j) = global_ws(j)/n
dof(j) = n - scale(j)
10    CONTINUE
      CALL WAVE_SIGNIF (isigtest,n,sst,dt,mother,param,dj,jtot,
     &      scale,period,lag1,siglvl,dof,fft_theor,global_signif,
     &      ymean,variance,Cdelta,psi0)

      isigtest = 2
      siglvl = 0.05D0
      savg_dof(1) = 2.0D0
      savg_dof(2) = 7.9D0
      javg1 = 0
      javg2 = 0
      DO 30 j=1,jtot
IF ((scale(j).GE.savg_dof(1)).AND.(javg1.EQ.0)) javg1 = j
IF (scale(j).LE.savg_dof(2)) javg2 = j
30    CONTINUE
      CALL WAVE_SIGNIF (isigtest,n,sst,dt,mother,param,dj,jtot,
     &    scale,period,lag1,siglvl,savg_dof,fft_theor,savg_signif,
     &    ymean,variance,Cdelta,psi0)
      DO 50 i=1,n
savg_ws(i) = 0.D0
savg_sst(i) = 0.D0
DO 60 j=javg1,javg2
   savg_ws(i) = savg_ws(i) + (ABS(wave(i,j))**2)/scale(j)
   savg_sst(i) = savg_sst(i) + (DBLE(wave(i,j)))/SQRT(scale(j))
60 CONTINUE
savg_ws(i) = dj*dt*savg_ws(i)/Cdelta
SAVG_sst(i) = dj*SQRT(dt)*SAVG_sst(i)/(Cdelta*psi0)
50    CONTINUE

      PRINT*,' n=',n
      PRINT*,' dt=',dt
      PRINT*,' mother=',mother
      PRINT*,' param=',param
      PRINT*,' s0=',s0
      PRINT*,' dj=',dj
      PRINT*,' jtot=',jtot
      PRINT*,' npad=',npad
      PRINT'(/,"Let w = wave(n/2,j)",/)'
      PRINT'(A4,7A10)',"j","Scale","Period","ABS(w)^2","phase(w)",
     &  "5%signif","Global","GWS5%sig"
      PRINT'(I4,7F10.3)',(j,scale(j),period(j),
     &   ABS(wave(n/2,j))**2,
     &   ATAN2(DIMAG(wave(n/2,j)),DBLE(wave(n/2,j)))*180.D0/pi,
     &   signif(j),global_ws(j),global_signif(j),j=1,jtot)
      PRINT'(/,A,F10.3)',
     &    ' Scale-average degrees of freedom = ',savg_dof(1)
      PRINT'(A,F10.3,/)',
     &    ' Scale-avg 5% significance level  = ',savg_signif(1)
      print*,'lag1=',lag1

      recon_vari = 0.D0
      DO 900 i=1,n
DO 1000 j=1,jtot
   recon_vari = recon_vari + (ABS(wave(i,j))**2)/scale(j)
1000 CONTINUE
900   CONTINUE
      recon_vari = dj*dt*recon_vari/(Cdelta*n)
      PRINT'(A,F14.5)',' Reconstructed variance=',recon_vari
      PRINT'(A,F14.5)',' Original variance   =',variance
      PRINT'(A,F14.5,A,/)',' Ratio = ',recon_vari/variance,
     &     ' (this is low due to padding with zeroes)'

      recon_mean=0.D0
      recon_vari = 0.D0
      DO 1100 i=1,n
recon_sst(i)=0.D0
DO 1200 j=1,jtot
   recon_sst(i) = recon_sst(i)+(DBLE(wave(i,j)))/SQRT(scale(j))
1200 CONTINUE
recon_sst(i) = dj*SQRT(dt)*recon_sst(i)/(Cdelta*psi0)
recon_vari = recon_vari+(sst(i)-ymean-recon_sst(i))**2
recon_mean = recon_mean + recon_sst(i)
1100  CONTINUE
      recon_mean = recon_mean/n
      recon_vari = SQRT(recon_vari/n)
      PRINT'(A,F14.6)',' Reconstructed mean=',recon_mean
      PRINT'(A,F14.6)',' Original mean   =',ymean
      PRINT'(A,F14.6,/)',' Root-mean-square difference of time series=',
     &      recon_vari

        OPEN(77,FILE='waliguan.OUT')
WRITE(77,*)'FOURIER PERIOD'
WRITE(77,777)(PERIOD(J),J=1,JTOT)
WRITE(77,*)'WAVELET POWER'
DO I=1,N
           WRITE(77,777)(dble(wave(i,j)),J=1,JTOT)
ENDDO
WRITE(77,*)'LOCAL SIGNIFICANCE'
        WRITE(77,777)(SIGNIF(J)/variance,J=1,JTOT)

WRITE(77,*)'CONE OF INFLUENCE'
WRITE(77,777)(COI(I),I=1,N)

WRITE(77,*)'GLOBAL WAVELET SPECTRUM'
        WRITE(77,777)(GLOBAL_WS(J)/VARIANCE,J=1,JTOT)

WRITE(77,*)'GLOBAL SIGNIFICANCE'
        WRITE(77,777)(GLOBAL_SIGNIF(J)/variance,J=1,JTOT)

WRITE(77,*)'SCALE AVGRERAGE SSTA'
WRITE(77,777)(SAVG_sst(I),I=1,N)
777 FORMAT(50F20.15)
CLOSE(77)
      END
      subroutine corr(sst,n,lag1)
      integer n,i
      DOUBLE PRECISION sst(n),lag1
      double precision bm,cm,suf,sua,svb,a,b
        CM=0.
        BM=0.
        DO 602 i=1,n-1
        CM=CM+sst(I)
        BM=BM+sst(I+1)
602     CONTINUE
        CM=CM/float(n-1)
        BM=BM/float(n-1)
      
        SUF=0.0
        SUA=0.0
        SVB=0.0
        DO 603 i=1,n-1
        A=sst(I)-CM      
        B=sst(i+1)-BM      
        SUF=SUF+A*B
        SUA=SUA+A*A
        SVB=SVB+B*B
603     CONTINUE
        lag1=SUF/SQRT(SUA*SVB)
        return
        end

密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2016-10-13 10:00:45 | 显示全部楼层
缺少子程序吧
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2016-10-13 10:08:02 | 显示全部楼层

怎么解决呢,谢谢了
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2016-10-13 10:28:35 | 显示全部楼层

SUBROUTINE WAVELET (n,y,dt,mother,param,s0,dj,jtot,npad,
     &                          wave,scale,period,coi)
      IMPLICIT none

      INTEGER n,mother,jtot,npad
      DOUBLE PRECISION y(n),dt,param,s0,dj,scale(jtot),period(jtot),
     &        coi(n)
      DOUBLE COMPLEX wave(n,jtot)

      INTEGER i,j,k,nk
      DOUBLE PRECISION ymean,freq1,pi,period1,coi1

C** initialize work arrays
      PARAMETER (nk=65535)
      DOUBLE PRECISION wsave(4*nk+15),kwave(nk)
      DOUBLE COMPLEX yfft(nk),daughter(nk)

      pi = 4.D0*ATAN(1.D0)

      IF (npad.LT.n) THEN
        PRINT*,'**WAVELET: "npad" must be greater than or equal to "n"'
        RETURN
      END IF

      IF ((mother.LT.0).OR.(mother.GT.2)) mother = 0

C** find the time-series mean & remove it
      ymean = 0.D0
      DO 10 i=1,n
        ymean = ymean + y(i)
10    CONTINUE
      ymean = ymean/n
      DO 15 i=1,n
        yfft(i) = y(i) - ymean
15    CONTINUE

C** if desired, pad with extra zeroes
      DO 20 i=n+1,npad
        yfft(i) = 0.D0
20    CONTINUE

C** find the FFT of the time series [Eqn(3)]
      CALL CFFTI(npad,wsave)
      CALL CFFTF(npad,yfft,wsave)
      DO 30 k=1,npad
        yfft(k) = yfft(k)/npad
30    CONTINUE

C** construct the wavenumber array [Eqn(5)]
      freq1 = 2.D0*pi/(DBLE(npad)*dt)
      kwave(1) = 0.D0
      DO 40 i=2,npad/2+1
        kwave(i) = (DBLE(i)-1.D0)*freq1
40    CONTINUE
      DO 50 i=npad/2+2,npad
        kwave(i) = -kwave(npad-i+2)
50    CONTINUE

c**----- Main wavelet loop
c      PRINT '(A8,2A12,/,5X,27("-"))','j','scale','period'
      DO 100 j=1,jtot
        scale(j) = s0*(2.D0**(DBLE(j-1)*dj))
        CALL WAVE_FUNCTION(npad,dt,mother,param,scale(j),
     &                         kwave,period1,coi1,daughter)
        period(j) = period1
C**    multiply the daughter by the time-series FFT
        DO 60 k=1,npad
          daughter(k) = daughter(k)*yfft(k)
60        CONTINUE
C**    inverse FFT [Eqn(4)]
        CALL CFFTB(npad,daughter,wsave)
C**    store the wavelet transform, discard zero-padding at end
        DO 70 i=1,n
          wave(i,j) = daughter(i)
70        CONTINUE
c         PRINT '(I8,2F12.3)',j,scale(j),period(j)
100   CONTINUE
c**----- end loop

C** construct the cone of influence
      DO 110 i=1,(n+1)/2
        coi(i) = coi1*dt*(DBLE(i)-1.D0)
        coi(n-i+1) = coi(i)
110   CONTINUE

      RETURN
      END




      SUBROUTINE WAVE_FUNCTION (nk,dt,mother,param,scale1,
     &                                kwave,period1,coi1,daughter)
      IMPLICIT none

      INTEGER nk,mother
      DOUBLE PRECISION dt,kwave(nk),param,scale1,period1,coi1
      DOUBLE COMPLEX daughter(nk)

      DOUBLE PRECISION expnt,sk,pi,norm,fourier_factor
      INTEGER k,m,factorial
      DOUBLE PRECISION gamma

      pi = 4.D0*ATAN(1.D0)

      IF (mother.EQ.0) THEN

        IF (param.LT.0) param = 6.D0
        norm = SQRT(2.D0*pi*scale1/dt)*(pi**(-0.25D0))
        DO 10 k=1,nk/2+1
          expnt = -0.5D0*(scale1*kwave(k) - param)**2
          daughter(k) = DCMPLX(norm*EXP(expnt))
10        CONTINUE
         DO 20 k=nk/2+2,nk
          daughter(k) = DCMPLX(0.D0)
20        CONTINUE
        fourier_factor = (4.D0*pi)/(param + SQRT(2.D0+param**2))
        period1 = scale1*fourier_factor
        coi1 = fourier_factor/SQRT(2.D0)
      ELSE IF (mother.EQ.1) THEN

        IF (param.LT.0) param = 4.D0
        m = INT(param)
        norm = SQRT(2.D0*pi*scale1/dt)*
     &               (2.D0**m/SQRT(DBLE(m*FACTORIAL(2*m-1))))
        DO 30 k=1,nk/2+1
          expnt = -scale1*kwave(k)
          daughter(k) = DCMPLX(norm*(scale1*kwave(k))**m*EXP(expnt))
30        CONTINUE
         DO 40 k=nk/2+2,nk
          daughter(k) = DCMPLX(0.D0)
40        CONTINUE
        fourier_factor = (4.D0*pi)/(2.D0*m + 1.D0)
        period1 = scale1*fourier_factor
        coi1 = fourier_factor*SQRT(2.D0)
      ELSE IF (mother.EQ.2) THEN

        IF (param.LT.0) param = 2.D0
        m = INT(param)
        norm = SQRT(2.D0*pi*scale1/dt)*SQRT(1.D0/GAMMA(m+0.5D0))
        norm = -norm*(DCMPLX(0.D0,1.D0)**m)
        DO 50 k=1,nk
          sk = scale1*kwave(k)
          daughter(k) = norm*(sk**m)*EXP(-0.5D0*sk**2)
50        CONTINUE
        fourier_factor = 2.D0*pi*SQRT(2.D0/(2.D0*m+1.D0))
        period1 = scale1*fourier_factor
        coi1 = fourier_factor/SQRT(2.D0)
      ELSE
        stop
      END IF
      RETURN
      END


      FUNCTION FACTORIAL(n)
      IMPLICIT NONE
      INTEGER factorial,n,i

      factorial = 1
      DO 10 i=1,n
        factorial = factorial*i
10    CONTINUE
      END





      SUBROUTINE WAVE_SIGNIF (isigtest,n,y,dt,mother,param,dj,jtot,
     &             scale,period,lag1,siglvl,dof,fft_theor,signif,
     &             ymean,variance,Cdelta,psi0)
      IMPLICIT none

      INTEGER isigtest,n,mother,jtot
      DOUBLE PRECISION y(n),dt,param,dj,scale(jtot),period(jtot)
      DOUBLE PRECISION lag1,siglvl,dof(jtot),fft_theor(jtot),
     &        signif(jtot)
      DOUBLE PRECISION ymean,variance,Cdelta,psi0

      INTEGER i,j,m,status,javg1,javg2,navg
      DOUBLE PRECISION pi,freq1,dofmin,gammafac,dj0,Savg,Smid
      DOUBLE PRECISION fft_theor1
      DOUBLE PRECISION chisqr,p,q,bound

      pi = 4.D0*ATAN(1.D0)

      IF (siglvl.LE.0.) siglvl = 0.05D0
      IF (lag1.LE.0.D0) lag1 = 0.D0

      Cdelta = -1.D0
      gammafac = -1.D0
      dj0 = -1.D0
      psi0 = -1.D0

      IF (mother.EQ.0) THEN

        dofmin = 2.D0
        IF (param.EQ.6.D0) THEN
          Cdelta = 0.776D0
          gammafac = 2.32D0
          dj0 = 0.60D0
          psi0 = pi**(-0.25D0)
        END IF
      ELSE IF (mother.EQ.1) THEN

        m = INT(param)
        dofmin = 2.D0
        IF (m.EQ.4) THEN
          Cdelta = 1.132D0
          gammafac = 1.17D0
          dj0 = 1.5D0
          psi0 = 1.079D0
        END IF
      ELSE IF (mother.EQ.2) THEN

        m = INT(param)
        dofmin = 1.D0
        IF (m.EQ.2) THEN
          Cdelta = 3.541D0
          gammafac = 1.43D0
          dj0 = 1.4D0
          psi0 = 0.867D0
        ELSE IF (m.EQ.6) THEN
          Cdelta = 1.966D0
          gammafac = 1.37D0
          dj0 = 0.97D0
          psi0 = 0.884D0
        END IF
      ELSE
        stop
      END IF


      ymean = 0.D0
      DO 10 i=1,n
        ymean = ymean + y(i)
10    CONTINUE
      ymean = ymean/n
      variance = 0.D0
      DO 15 i=1,n
        variance = variance + (y(i) - ymean)**2
15    CONTINUE
      variance = variance/(DBLE(n)) ! - 1.D0)


      DO 20 j=1,jtot
        freq1 = dt/period(j)
        fft_theor(j) = variance*(1.D0-lag1**2)/
     &                       (1.D0 - 2.D0*lag1*COS(freq1*2.D0*pi) + lag1**2)
20    CONTINUE

      q = DBLE(siglvl)
      p = 1d0 - q

      IF (isigtest.EQ.0) THEN

        DO 30 j=1,jtot
          dof(j) = dofmin
          CALL CDFCHI(2,p,q,chisqr,DBLE(dofmin),status,bound)
          signif(j) = fft_theor(j)*chisqr/dofmin
30        CONTINUE
      ELSE IF (isigtest.EQ.1) THEN

        IF (gammafac.LE.0.D0) THEN
        PRINT*,'**WAVE_SIGNIF: "gammafac" undefined for this wavelet'
          RETURN
        END IF
        DO 40 j=1,jtot
            IF (dof(j).LT.1.) dof(j) = 1.D0

            dof(j) = dofmin*SQRT(1.D0+(dof(j)*dt/gammafac/scale(j))**2)
            IF (dof(j).LT.dofmin) dof(j) = dofmin
            CALL CDFCHI(2,p,q,chisqr,DBLE(dof(j)),status,bound)
            signif(j) = fft_theor(j)*chisqr/dof(j)
40        CONTINUE
       ELSE IF (isigtest.EQ.2) THEN

        IF (Cdelta.LE.0.) THEN
          PRINT*,'**WAVE_SIGNIF: "Cdelta" and "dj0" '//
     &           'undefined for this wavelet'
          RETURN
        END IF
        javg1 = 0
        javg2 = 0
        DO 50 j=1,jtot
          IF ((scale(j).GE.dof(1)).AND.(javg1.EQ.0)) javg1 = j
          IF (scale(j).LE.dof(2)) javg2 = j
50        CONTINUE
        IF ((javg1.EQ.0).OR.(javg2.EQ.0).OR.(javg1.GT.javg2)) THEN
          PRINT*,'**WAVE_SIGNIF: Scales in "dof(1)" & "dof(2)" '//
     &           'are out of range.'
          RETURN
        END IF
        navg = javg2 - javg1 + 1

        Savg = 0.D0
        DO 60 j=javg1,javg2
          Savg = Savg + 1.D0/scale(j)
60        CONTINUE
        Savg = 1.D0/Savg

        fft_theor1 = 0.D0
        DO 70 j=javg1,javg2
          fft_theor1 = fft_theor1 + fft_theor(j)/scale(j)
70        CONTINUE
        fft_theor(1) = Savg*fft_theor1

        Smid = EXP(0.5D0*(LOG(scale(javg1)) + LOG(scale(javg2))))
        dof(1) = (dofmin*navg*Savg/Smid)*SQRT(1 + (navg*dj/dj0)**2)

        CALL CDFCHI(2,p,q,chisqr,DBLE(dof(1)),status,bound)
        signif(1)=(dj*dt/Cdelta/Savg)*fft_theor(1)*chisqr/dof(1)
        DO 80 j=2,jtot
          dof(j) = 0.D0
          fft_theor(j) = 0.D0
          signif(j) = 0.D0
80        CONTINUE
      ELSE
        stop
      END IF

      END

你说的是这个子程序吧,是有的
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2016-10-13 10:47:46 | 显示全部楼层
这些subroutine要么放在主程序最后要么用include
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2016-10-13 11:09:53 | 显示全部楼层
lqouc 发表于 2016-10-13 10:47
这些subroutine要么放在主程序最后要么用include

好的,谢谢了
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表