51 lines
1.3 KiB
Fortran
51 lines
1.3 KiB
Fortran
! <Subroutine weight(wt,y,ntot,numdatpt)
|
|
subroutine weight(wt,y)
|
|
use dim_parameter, only: nstat,ndiab,nci,ntot,numdatpt,
|
|
> hybrid,wt_en2ci,wt_en,wt_ci
|
|
implicit none
|
|
! data arrays and their dimensions
|
|
double precision wt(ntot,numdatpt),y(ntot,numdatpt)
|
|
! loop index
|
|
integer i,j,k,n
|
|
|
|
do i=1,numdatpt
|
|
wt(1,i)=1.d0
|
|
enddo
|
|
|
|
call norm_weight(wt,ntot,numdatpt)
|
|
|
|
end
|
|
|
|
!----------------------------------------------------------------------------------------------------
|
|
! <Subroutine norm_weight(wt,ntot,numdatpt)
|
|
subroutine norm_weight(wt,ntot,numdatpt)
|
|
implicit none
|
|
integer ntot,numdatpt
|
|
double precision norm,wt(ntot,numdatpt)
|
|
integer i,j,count
|
|
|
|
write(6,*) 'Normalizing Weights...'
|
|
norm=0.d0
|
|
count = 0
|
|
do i=1,numdatpt
|
|
do j=1,ntot
|
|
norm = norm + wt(j,i)*wt(j,i)
|
|
if (wt(j,i).gt.0.d0) count=count+1
|
|
enddo
|
|
enddo
|
|
|
|
norm = dsqrt(norm)
|
|
if(norm.gt.0.d0) then
|
|
do i=1,numdatpt
|
|
do j=1,ntot
|
|
wt(j,i) = wt(j,i)/norm
|
|
enddo
|
|
enddo
|
|
else
|
|
write(6,*) 'Warning: Norm of Weights is Zero'
|
|
endif
|
|
|
|
Write(6,'(''No. of weigthed data points:'',i0)') count
|
|
|
|
end subroutine
|