program chi_square !********************************************************************** ! * . . . ! * PROGRAM: CHI_SQUARE ! * PRGMMR: M. ZUPANSKI ORG: CIRA/CSU DATE: 2003-10-21 ! * ! * ABSTRACT: CALCULATE CHI SQUARE TEST FOR NORMALIZED INNOVATION VECTORS ! * ! * PROGRAM LOG: ! * ! * 10/21/2003 ..... M. ZUPANSKI: ! * ! ********************************************************************** !---------------------------------- ! INPUT: ! x_1 - normalized innovation vector ! ! OUTPUT: ! product - inner product: (x_1**T)*x_1 ! !---------------------------------- !----- integer,parameter::ifile1=20 ! input file # integer,parameter::chi=51 ! output file # !----- integer :: N_dim,NN real :: product real,dimension(:),allocatable::x_1 !----- !==============start calculation=================== !-- read 1st file rewind ifile1 read(ifile1) N_dim allocate(x_1(1:N_dim)) read(ifile1) x_1 write(*,*) "N_obs=",N_dim !-- Inner product -------------------- product=0.0 do i=1,N_dim product=product+x_1(i)*x_1(i) end do write(*,*) "Raw product=",product product=product/float(N_dim) write(*,*) "Normalized product=",product !-- chi_square --------------- rewind chi write(chi,100) N_dim,product 100 format(I15,E20.10) end program chi_square