(file) Return to sub_correlate_BLAS.f CVS log (file) (dir) Up to [Development] / JSOC / proj / timed / apps

File: [Development] / JSOC / proj / timed / apps / sub_correlate_BLAS.f (download)
Revision: 1.1, Tue Nov 15 20:32:50 2011 UTC (11 years, 6 months ago) by rick
Branch: MAIN
CVS Tags: Ver_LATEST, Ver_9-5, Ver_9-41, Ver_9-4, Ver_9-3, Ver_9-2, Ver_9-1, Ver_9-0, Ver_8-8, Ver_8-7, Ver_8-6, Ver_8-5, Ver_8-4, Ver_8-3, Ver_8-2, Ver_8-12, Ver_8-11, Ver_8-10, Ver_8-1, Ver_8-0, Ver_7-1, Ver_7-0, Ver_6-4, Ver_6-3, Ver_6-2, Ver_6-1, Ver_6-0, HEAD
added for JSOC release 6.0

CC This is a new subroutine to compute correlation by calling the BLAS
CC library to compute the dot-product. However, the computation of 
CC averages seems stupid. But no BLAS FUNCTION does that.  ... Mar 2, 2005
      SUBROUTINE c_correlate(x,y,n,lag,m,ans)
CC    x and y are data series with dimension of n, and
CC    lag's dimension is m. ans(m) is the results
      DIMENSION x(n), y(n), ans(m),lag(m)

CC    first is to get the average of both x and y
      total_x=0.
      total_y=0.
      DO 10 i=1, n
         total_x=total_x+x(i)
         total_y=total_y+y(i)
 10   CONTINUE
      ave_x=total_x/n
      ave_y=total_y/n
      DO 20 i=1,n
         x(i)=x(i)-ave_x
         y(i)=y(i)-ave_y
 20   CONTINUE

CC    The following is to begin the calculation of
CC    cross-covariance function
      DO 100 l=1, m
         ilag=lag(l)
         IF(ilag.LT.0) THEN
            tot=0.
            tot=SDOT(n+ilag,x(1-ilag),1,y,1)
            ans(l)=tot/n
         ELSE
            tot=0.
            tot=SDOT(n-ilag,x,1,y(1+ilag),1)
            ans(l)=tot/n
         ENDIF
 100  ENDDO

      RETURN
      END


Karen Tian
Powered by
ViewCVS 0.9.4