亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? gmm.f90

?? 這是一個實數編碼的遺傳算法
?? F90
?? 第 1 頁 / 共 3 頁
字號:
SUBROUTINE GMM(gmm_type,a,wtmtx_a,gmm_a,weighting_type,nma,        &
               init_estimate,gmm_itts,do_stats,deriv_type,         &
               eps_vector,itmax,FRET,covmtx,use_gmm_a,indep_var,   &
               nerr)
implicit none

include  'dim_dat.inc'

!maximum possible number of moments
integer, parameter ::max_num_moments=no_of_equations*              &
                                     no_of_instruments
! the size of the first dimension of Fmtx
integer, parameter ::dim1_of_Fmtx=max(max_num_as,np*5)

real(8), dimension(:)                ::a,eps_vector,wtmtx_a,gmm_a
real(8), dimension(:,:)              ::covmtx
real(8), dimension(:,:)              ::indep_var
integer  weighting_type,deriv_type,nerr,gmm_itts,itmax,HESSINreset
integer  nma,init_estimate, do_stats, GMM_type
real(8)  fret

real(8), dimension(dim1_of_Fmtx,max_num_moments,nobs)::Fmtx
real(8), dimension(max_num_moments,max_num_moments)  ::W
real(8), dimension(size(a))                          ::a1
real(8), dimension(1:1,size(a))                      ::as
real(8), dimension(no_of_equations,no_of_equations)  ::crosscovmtx
real(8), dimension(1:1,no_of_equations,nobs)         ::resid
integer, dimension(no_of_equations)                  ::num_inst
integer, dimension(3)                                ::spare_params
character(len=no_of_instruments),dimension(                        &
                                     no_of_equations)::instruments
real(8)  conv1,conv2,conv3,schlength,setconv1,setconv2,setconv3
real(8)  setgmmconv1,setgmmconv2,setgmmconv3
real(8)  small,root_small,gmm_root_small,var,gmm_itt_small
integer  i,j,ii,num_moments,num_derivs,m,gmm_counter
logical  nsls_type,gmm_stage,matrix_ill,use_gmm_a
character(len=10) nsls_string

common/flag_instruments/ instruments
common/gmm_specific/     Fmtx,W,num_inst

external funcgmm0
external funcgmm1

include 'blas.inc'
include 'routines.inc'

interface
   SUBROUTINE wtmtx(a,weighting_type,nma,num_moments)
      real(8), dimension(:)     ::a
      integer weighting_type, nma, num_moments
   END SUBROUTINE wtmtx
END INTERFACE

interface
   SUBROUTINE calccovmtx(a,deriv_type,eps_vector,covmtx,           &
                         num_moments,matrix_ill)
      real(8), dimension(:)             ::a,eps_vector
      real(8), dimension(:,:)           ::covmtx
      integer  deriv_type,num_moments
      logical  matrix_ill
   end SUBROUTINE calccovmtx
END INTERFACE

interface
   SUBROUTINE residual(as,resid,nerr)
      real(8), dimension(:,:)       ::as
      real(8), dimension(:,:,:)   ::resid
      integer nerr
   end SUBROUTINE residual
end interface

interface
  SUBROUTINE constfmtx(as)
    real(8), dimension(:,:)      ::as
  END SUBROUTINE constfmtx
END INTERFACE

  if(size(eps_vector).ne.size(a)) then
    write(*,*)'incorrect dimensioning between parameter vector'
    write(*,*)'and eps_vector:  PROGRAM STOPPED'
    STOP
  end if

! force an error if certain files do not exist.
   write(*,*) 'testing the opening of file a.vec'
   open(10,file='a.vec',status='old')
   close(10)
   write(*,*) 'testing the opening of file wtmtxa.vec'
   open(10,file='wtmtxa.vec',status='old')
   close(10)
   write(*,*) 'testing the opening of file weight.in'
   open(10,file='weight.in',status='old')
   close(10)
   write(*,*) 'testing the opening of file weight.out'
   open(10,file='weight.out',status='old')
   close(10)
   write(*,*) 'testing the opening of file series.out'
   open(10,file='series.out',status='old')
   close(10)

! force an error if nma is not set to a valid option
   if(nma.lt.-3) then
      write(*,*)'invalid NMA choice - PROGRAM STOPPED'
      stop
   end if

! force an error if new GMM procedure is used with nma=-3
   if((gmm_type.eq.1).and.(nma.eq.-3)) then
      write(*,*)'incompatible NMA choice and GMM TYPE:'
      write(*,*)' PROGRAM STOPPED'
      stop
   end if

! define a small number
   small=epsilon(0.0d0)
   root_small=small**0.5d0
   gmm_root_small=small**0.5d0
   gmm_itt_small=small**0.3d0

! define parameters for minimisation routine (see MINIMIZE)
   setconv1 = root_small
   setconv2 = size(a) * root_small
   setconv3 = size(a) * root_small
   setgmmconv1 = gmm_root_small
   setgmmconv2 = size(a) * gmm_root_small
   setgmmconv3 = size(a) * gmm_root_small

   HESSINreset = 6
   schlength = 10.0d0
   nerr=0
   num_derivs=2

! set num_inst and num_moments
   num_moments=0
   num_inst=0
   do j=1,no_of_equations
     do i=1,no_of_instruments
       if (instruments(j)(i:i).eq.'1') then 
         num_moments=num_moments+1
         num_inst(j)=num_inst(j)+1
       end if
     end do
   end do

! determine if all the instruments are the same,
! if so NSLS_TYPE=.true.
   gmm_stage=.false.
   nsls_type=.true.
   nsls_string='(modified)'
   do j=2,no_of_equations
     if (instruments(j).ne.instruments(1)) nsls_type=.false.
   end do
   if(nsls_type) nsls_string=''

! parameters which must be passed to function to be minimised.
   spare_params(1)=weighting_type
   spare_params(2)=nma
   spare_params(3)=num_moments

   if(init_estimate.eq.2 .or. init_estimate.eq.3) then    ! do 2SLS
     call setinst
     m = 1
     W=0.0d0
     do j=1,no_of_equations
       i=m+num_inst(j)-1
       W(m:i,m:i) = matmul( Fmtx(1,m:i,:),transpose(Fmtx(1,m:i,:)) )
       call inverse(W(m:i,m:i),matrix_ill)
       if(matrix_ill) then
           write(*,*)'PROGRAM STOPPED'
           STOP
       end if
       m=m+num_inst(j)
     end do
     conv1 = setconv1
     conv2 = setconv2 
     conv3 = setconv3
     call MINIMIZE (spare_params,a,max_num_as,funcgmm0,            &
                    HESSINreset,itmax,schlength,deriv_type,        &
                    eps_vector,num_derivs,conv1,conv2,conv3,FRET,  &
                    nerr)
     write(*,*)'function stepsize =',conv1
     write(*,*)'L2 norm of change in parameter vector =',conv2
     write(*,*)'L2 norm of the gradient',conv3
     write(*,*)
     write(*,*)
     write(*,*) '2SLS ',nsls_string, 'parameter estimates:'
     write(*,*) 'function minimum = ',fret/real(nobs,kind(0.0d0))
     write(*,*) 'parameter vector = ',a
     if(do_stats.eq.2) then
       call cross_equ_cov(a,crosscovmtx)
       var=0.0d0
       do i=1,no_of_equations
         var=var+crosscovmtx(i,i)
       end do
       var=var/real(no_of_equations,kind(0.0d0))
       W(1:num_moments,1:num_moments)=W(1:num_moments,             &
                                        1:num_moments)/var
       call write_stats(a,gmm_stage)
       W(1:num_moments,1:num_moments)=W(1:num_moments,1:           &
                                        num_moments)*var
     end if
   wtmtx_a=a
   end if

   if(init_estimate.eq.3) then  ! do 3SLS. Uses existing W from 2SLS
     call cross_equ_cov(a,crosscovmtx)
     if (nsls_type) then
       call inverse(crosscovmtx,matrix_ill)
       if(matrix_ill) then
          write(*,*)'PROGRAM STOPPED'
          stop
       end if     
       W(1:num_moments,1:num_moments)=mtx_cross_product(           &
                  crosscovmtx,W(1:num_inst(1),1:num_inst(1)))
     else
       m = 1
       do j=1,no_of_equations
         i=m+num_inst(j)-1
         W(m:i,m:i) = W(m:i,m:i)/crosscovmtx(j,j)
         m=m+num_inst(j)
       end do
     end if
     conv1 = setconv1
     conv2 = setconv2 
     conv3 = setconv3
     call MINIMIZE (spare_params,a,max_num_as,funcgmm0,            &
                    HESSINreset,itmax,schlength,deriv_type,        &
                    eps_vector,num_derivs,conv1,conv2,conv3,       &
                    FRET,nerr)
     write(*,*)'function stepsize =',conv1
     write(*,*)'L2 norm of change in parameter vector =',conv2
     write(*,*)'L2 norm of the gradient',conv3
     write(*,*)
     write(*,*)
     write(*,*) '3SLS ',nsls_string, 'parameter estimates:'
     write(*,*) 'function minimum = ',fret/real(nobs,kind(0.0d0))
     write(*,*) 'parameter vector = ',a
     if(do_stats.eq.2) call write_stats(a,gmm_stage)
     wtmtx_a=a
   end if

   if(init_estimate.eq.0) then    ! do GMM with W = identity
      W(1:num_moments,1:num_moments)=IDENTITY(num_moments)
      conv1 = setconv1
      conv2 = setconv2 
      conv3 = setconv3
      call MINIMIZE (spare_params,a,max_num_as,funcgmm0,           &
                     HESSINreset,itmax,schlength,deriv_type,       &
                     eps_vector,num_derivs,conv1,conv2,conv3,      &
                     FRET,nerr)
      write(*,*)'function stepsize =',conv1
      write(*,*)'L2 norm of change in parameter vector =',conv2
      write(*,*)'L2 norm of the gradient',conv3
      write(*,*)
      write(*,*)
      WRITE(*,*) 'GMM with W=IDENTITY parameter estimates:' 
      write(*,*) 'function minimum = ',fret/real(nobs,kind(0.0d0))
      write(*,*) 'parameter vector = ',a
      wtmtx_a=a
   end if

   if(init_estimate.eq.1) then    ! do GMM with W = specified
      open(10,file='weight.in',status='old')
      do i=1,num_moments
        do j=1,num_moments
          read(10,*)W(i,j)
        end do
      end do
      close(10)
      write(*,*)
      write(*,*)'weighting matrix used for initial estimate'
      do i=1,num_moments
         write(*,*)W(i,:)
      end do
      write(*,*)

      W(1:num_moments,1:num_moments)=W(1:num_moments,1:            &
                      num_moments)/real(nobs,kind(0.0d0))

      conv1 = setgmmconv1
      conv2 = setgmmconv2 
      conv3 = setgmmconv3
      call MINIMIZE (spare_params,a,max_num_as,funcgmm0,           &
                     HESSINreset,itmax,schlength,deriv_type,       &
                     eps_vector,num_derivs,conv1,conv2,conv3,      &
                     FRET,nerr)
      write(*,*)'function stepsize =',conv1
      write(*,*)'L2 norm of change in parameter vector =',conv2
      write(*,*)'L2 norm of the gradient',conv3
      write(*,*)
      write(*,*)
      write(*,*) 'GMM with W=specified, parameter estimates:' 
      write(*,*) 'function minimum = ',fret/real(nobs,kind(0.0d0))
      write(*,*) 'parameter vector = ',a
      if (do_stats.eq.2) call write_stats(a,gmm_stage)
      wtmtx_a=a
   end if


   gmm_stage=.true.
   if(use_gmm_a) a=gmm_a

   if (gmm_type.eq.0) then
     a1=wtmtx_a
     gmm_counter=0
     write(*,*)'STANDARD GMM PROCEDURE (GMM TYPE 0) NOW STARTING'
     write(*,*)
     do
       gmm_counter=gmm_counter+1
       call wtmtx(wtmtx_a,weighting_type,nma,num_moments)
       conv1 = setgmmconv1
       conv2 = setgmmconv2 
       conv3 = setgmmconv3
       call MINIMIZE (spare_params,a,max_num_as,funcgmm0,          &
                      HESSINreset,itmax,schlength,deriv_type,      &
                      eps_vector,num_derivs,conv1,conv2,conv3,     &
                      FRET,nerr)
       write(*,*)'function stepsize =',conv1
       write(*,*)'L2 norm of change in parameter vector =',conv2
       write(*,*)'L2 norm of the gradient',conv3
       write(*,*)
       write(*,*)
       wtmtx_a=a
       open(10,file='wtmtxa.vec',status='old')
       rewind(10)
       do ii=1,size(wtmtx_a)
         write(10,*)wtmtx_a(ii)
       end do
       close(10)
       write(*,*) 'GMM minimisation ',gmm_counter,' complete' 
       write(*,*) 'function minimum = ',fret/real(nobs,kind(0.0d0))
       write(*,*) 'parameter vector = ',a
       write(*,*)
       if (do_stats.eq.2) call write_stats(a,gmm_stage)
       if(norm2(a1-a).le.(gmm_itt_small*norm2(a)+small)) exit
       if(gmm_counter.eq.gmm_itts) exit
       a1=a
     end do
     if (do_stats.eq.1) call write_stats(a,gmm_stage)
   end if

   if (gmm_type.eq.1) then
     write(*,*)'NEW GMM PROCEDURE (GMM TYPE 1) NOW STARTING'
     write(*,*)
     conv1 = setgmmconv1
     conv2 = setgmmconv2 
     conv3 = setgmmconv3
     call MINIMIZE (spare_params,a,max_num_as,funcgmm1,            &
                    HESSINreset,itmax,schlength,deriv_type,        &
                    eps_vector,num_derivs,conv1,conv2,conv3,       &
                    FRET,nerr)
     write(*,*)'function stepsize =',conv1
     write(*,*)'L2 norm of change in parameter vector =',conv2
     write(*,*)'L2 norm of the gradient',conv3
     write(*,*)
     write(*,*)
     nma=spare_params(2)
     write(*,*) 'GMM complete' 
     write(*,*) 'function minimum = ',fret/real(nobs,kind(0.0d0))
     write(*,*) 'parameter vector = ',a
     write(*,*)
     if (do_stats.eq.2 .or. do_stats.eq.1) call write_stats(a,     &
                                           gmm_stage)
   end if

   open(10,file='weight.out',status='old')
   rewind(10)
   do i=1,num_moments
     do j=1,num_moments

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品欧美综合在线观看最新| 国产精品一区二区三区网站| 国产日韩v精品一区二区| 欧美日韩久久久| 欧美日韩精品一区二区天天拍小说| 日本韩国精品一区二区在线观看| 高清在线观看日韩| 成人免费观看男女羞羞视频| 丁香婷婷综合色啪| 91蜜桃传媒精品久久久一区二区| 99久久国产免费看| 欧美吞精做爰啪啪高潮| 欧美三级日韩三级| 欧美精品电影在线播放| 91精品在线免费观看| 日韩免费性生活视频播放| 精品国产一区二区三区不卡 | 国产精品国产自产拍在线| 中文子幕无线码一区tr| 亚洲天堂精品视频| 亚洲午夜久久久久中文字幕久| 亚洲大片免费看| 久久91精品久久久久久秒播| 风间由美一区二区av101| 99国产精品国产精品久久| 精品视频色一区| 亚洲精品在线免费观看视频| 国产精品人成在线观看免费| 亚洲激情av在线| 精品一区二区三区视频| www.成人网.com| 日韩一区二区中文字幕| 国产亚洲1区2区3区| 一区二区三区色| 久久99精品久久久久久动态图| 成人高清免费观看| 欧美裸体一区二区三区| 久久精品视频免费| 一区二区日韩av| 国产成人精品www牛牛影视| 色哟哟国产精品| 日韩欧美一二三| 亚洲精品水蜜桃| 狠狠久久亚洲欧美| 欧美日韩一区二区三区在线| 亚洲精品一区二区三区福利 | 在线视频欧美精品| 日韩欧美美女一区二区三区| 日韩一区有码在线| 精品中文字幕一区二区| 91福利视频在线| 国产午夜精品久久| 成人一区在线观看| 日韩午夜精品视频| 亚洲免费高清视频在线| 国产剧情一区在线| 91精品在线一区二区| 亚洲精品精品亚洲| 国产成人鲁色资源国产91色综| 91麻豆精品国产91久久久久久| 亚洲色图制服丝袜| 福利电影一区二区| 国产午夜一区二区三区| 精品一区二区三区在线观看国产| 在线中文字幕一区二区| 国产精品久久99| 国产盗摄一区二区| 国产网站一区二区| 国产精品原创巨作av| 日韩欧美中文字幕精品| 五月激情综合网| 欧美男人的天堂一二区| 亚洲 欧美综合在线网络| 色噜噜狠狠色综合中国| 最新国产精品久久精品| 成人永久aaa| 中文字幕综合网| 色香蕉久久蜜桃| 一区二区三区四区在线免费观看| 成人黄色大片在线观看| √…a在线天堂一区| 成人h精品动漫一区二区三区| 国产精品久久久久久久久快鸭| 风间由美一区二区av101| 国产精品国产三级国产有无不卡| 成人综合激情网| 亚洲激情在线播放| 欧美欧美欧美欧美| 久久成人羞羞网站| 国产视频911| 色综合夜色一区| 亚洲自拍偷拍网站| 欧美日韩一区二区三区四区五区| 亚洲网友自拍偷拍| 欧美大片日本大片免费观看| 国产真实乱偷精品视频免| 欧美激情综合五月色丁香小说| av一区二区不卡| 亚洲妇女屁股眼交7| 欧美一级搡bbbb搡bbbb| 国产成人精品一区二区三区四区| 国产精品三级av在线播放| 色婷婷av一区二区三区软件| 亚洲超碰97人人做人人爱| 日韩精品最新网址| 成人黄色综合网站| 亚洲va韩国va欧美va精品| 欧美大白屁股肥臀xxxxxx| www.在线欧美| 青青青爽久久午夜综合久久午夜| 久久久亚洲精品石原莉奈| 色综合 综合色| 黑人巨大精品欧美一区| 亚洲精品免费看| 2023国产精华国产精品| 91在线丨porny丨国产| 麻豆一区二区99久久久久| 国产精品久久久久久久久免费樱桃 | 精品一区二区三区视频在线观看| 国产精品免费久久| 91精品久久久久久蜜臀| 成年人网站91| 蜜桃视频一区二区三区在线观看| 亚洲日本在线看| 精品国产乱码久久久久久久| 欧美专区日韩专区| 国产成人av一区二区| 午夜精品123| 亚洲另类在线一区| 久久综合九色综合97_久久久| 欧美亚洲高清一区二区三区不卡| 国产一区二区不卡| 视频一区二区欧美| 亚洲黄色av一区| 欧美国产日本韩| www成人在线观看| 91精品欧美综合在线观看最新| 91丨porny丨国产| 国产99久久久久久免费看农村| 五月激情丁香一区二区三区| 亚洲人成网站精品片在线观看| 久久综合丝袜日本网| 日韩午夜中文字幕| 91精品综合久久久久久| 欧美日韩你懂的| 欧美综合久久久| 欧美日韩国产综合一区二区| 色噜噜久久综合| 色综合久久中文字幕综合网| 成人免费高清在线| 成人一区二区三区视频在线观看| 九九九久久久精品| 国模少妇一区二区三区| 久久se精品一区精品二区| 日本不卡123| 美女视频一区二区| 激情综合色丁香一区二区| 欧美aaaaa成人免费观看视频| 日本不卡视频一二三区| 日本欧美久久久久免费播放网| 日韩高清在线电影| 毛片基地黄久久久久久天堂| 毛片基地黄久久久久久天堂| 免费成人在线观看视频| 久久er精品视频| 国产高清无密码一区二区三区| 国产成人精品影视| 91同城在线观看| 欧美日韩精品一区二区| 欧美日韩黄色一区二区| 日韩精品专区在线影院重磅| 亚洲精品一区二区三区99| 国产精品三级av| 伊人开心综合网| 毛片不卡一区二区| 成人一区二区三区在线观看 | 婷婷开心激情综合| 日本欧美久久久久免费播放网| 国内外成人在线视频| 成人妖精视频yjsp地址| 欧美优质美女网站| 日韩天堂在线观看| 国产精品污www在线观看| 日本中文在线一区| 高清在线成人网| 欧美午夜不卡在线观看免费| 欧美xingq一区二区| 国产精品护士白丝一区av| 天堂一区二区在线| 成人自拍视频在线观看| 欧美日韩一区久久| 久久久www成人免费毛片麻豆| 亚洲丝袜美腿综合| 精品一区二区三区在线观看国产| 成人精品免费网站| 91精品国产91综合久久蜜臀| 国产欧美一区二区精品性色超碰| 亚洲成人免费看| 不卡电影一区二区三区| 这里只有精品视频在线观看|