!----------- Variables in likelihood common blocks -----------
!
!nlikepoints: the number of sampling points for determining the parameters 
!             in the likelihood function
!ndesignparam: the number of design parameters
!xsamplike(nlikepoints,ndesignparam): the coordinates of the sampling points
!                                 of the design parameters
!ysamplike(nlikepoints): the actual values at the sampling points
!delvector: = R^(-1)(y-Fb)
!coeffbas:  on exit, holds the coefficients of the basis functions
!work: on exit, holds the upper triangle of the matrix R^(-1)F[F^tR^(-1)F)^(-1)F^(t)R^(-1)-R^(-1)
!fbassamp: on exit, holds the transpose of [F^(t)R^(-1)F]^(-1)F^(t)R^(-1)
!FtRinvF_inv: holds the upper triangle of the symmetric matrix [F^(t)R^(-1)F]^(-1)
!plikemin:   likelihood parameter lower bounds
!plikemax:   likelihood parameter upper bounds 
!isitlastcall: if it is the last call, calculates the matrices needed by the prediction
!maxnvars: the maximum number of cokriging variables
!nvars:    the actual number of cokriging variables
!kbasis:   the total number of basis functions for all variables
!kbasvar: the number of basis functions in each variable
!maxkbasvar: the maximum number of basis functions iin each variable
!indexvars: the integer vector that holds the number of observations for each
!           cokriging variables.
!ithetap: =1, pist=2.0; =2, pdist to be optimized
!kpvt: an integer array used in different subroutines, defined in common blocks
!      to save memory, does not transfer data through common blocks.

      integer maxdesignparam,maxlikepoints,maxkbasvar,maxnvars
      parameter(maxdesignparam=40,maxlikepoints=365*48,
     &          maxkbasvar=100,maxnvars=10)
      
      integer nlikepoints,ndesignparam,kbasis,kbasvar,
     &        nvars,indexvars,ithetap,kpvt
      common /likedim/nlikepoints,ndesignparam,kbasis,
     &     kbasvar(maxnvars),nvars,indexvars(maxnvars),
     &     ithetap,kpvt(maxlikepoints)
      
      double precision xsamplike,ysamplike,coeffbas,delvector,
     &     work,fbassamp,FtRinvF_inv
      common /likevar/xsamplike(maxlikepoints,maxdesignparam),
     & ysamplike(maxlikepoints),delvector(maxlikepoints),
     & coeffbas(maxkbasvar*maxnvars),
     & work(maxlikepoints*(maxlikepoints+1)/2),
     & fbassamp(maxlikepoints,maxkbasvar*maxnvars),
     & FtRinvF_inv(maxkbasvar*maxnvars*(maxkbasvar*maxnvars+1)/2)
      
      double precision plikemin,plikemax
      common /likebounds/plikemin(maxnvars*(maxnvars+1)*
     &                            (2*maxdesignparam+1)/2),
     &                   plikemax(maxnvars*(maxnvars+1)*
     &                            (2*maxdesignparam+1)/2)
      logical isitlastcall
      common /likelogic/isitlastcall
!----------------------------------------------------------      
