ccorm1d(3S)
CCORM1D, ZCORM1D, SCORM1D, DCORM1D - Compute multiple 1D correlations
As shipped in IRIX 6.5.22. Added in IRIX 6.5.15.
NAME CCORM1D, ZCORM1D, SCORM1D, DCORM1D - Compute multiple 1D correlations SYNOPSIS Single precision complex Fortran: CALL CCORM1D (x, incx, ldx, ix0, nx, nseq, h, inch, ih0, nh, y, incy, ldy, iy0, ny) C/C++: #include <scsl_fft.h> void ccorm1d (scsl_complex *x, int incx, int ldx, int ix0, int nx, int nseq, scsl_complex *h, int inch, int ih0, int nh, scsl_complex *y, int incy, int ldy, int iy0, int ny); C++ STL: #include <complex.h> #include <scsl_fft.h> void ccorm1d (complex<float> *x, int incx, int ldx, int ix0, int nx, int nseq, complex<float> *h, int inch, int ih0, int nh, complex<float> *y, int incy, int ldy, int iy0, int ny); Double precision complex Fortran: CALL ZCORM1D (x, incx, ldx, ix0, nx, nseq, h, inch, ih0, nh, y, incy, ldy, iy0, ny) C/C++: #include <scsl_fft.h> void zcorm1d (scsl_zomplex *x, int incx, int ldx, int ix0, int nx, int nseq, scsl_zomplex *h, int inch, int ih0, int nh, scsl_zomplex *y, int incy, int ldy, int iy0, int ny); C++ STL: #include <complex.h> #include <scsl_fft.h> void zcorm1d (complex<double> *x, int incx, int ldx, int ix0, int nx, int nseq, complex<double> *h, int inch, int ih0, int nh, complex<double> *y, int incy, int ldy, int iy0, int ny); Single precision Fortran: CALL SCORM1D (x, incx, ldx, ix0, nx, nseq, h, inch, ih0, nh, y, incy, ldy, iy0, ny) C/C++: #include <scsl_fft.h> void scorm1d (float *x, int incx, int ldx, int ix0, int nx, int nseq, float *h, int inch, int ih0, int nh, float *y, int incy, int ldy, int iy0, int ny); Double precision Fortran: CALL DCORM1D (x, incx, ldx, ix0, nx, nseq, h, inch, ih0, nh, y, incy, ldy, iy0, ny) C/C++: #include <scsl_fft.h> void dcorm1d (double *x, int incx, int ldx, int ix0, int nx, int nseq, double *h, int inch, int ih0, int nh, double *y, int incy, int ldy, int iy0, int ny); IMPLEMENTATION These routines are part of the SCSL Scientific Library and can be loaded using either the -lscs or the -lscs_mp option. The -lscs_mp option directs the linker to use the multi-processor version of the library. When linking to SCSL with -lscs or -lscs_mp, the default integer size is 4 bytes (32 bits). Another version of SCSL is available in which integers are 8 bytes (64 bits). This version allows the user access to larger memory sizes and helps when porting legacy Cray codes. It can be loaded by using the -lscs_i8 option or the -lscs_i8_mp option. A program may use only one of the two versions; 4-byte integer and 8-byte integer library calls cannot be mixed. The C and C++ prototypes shown above are appropriate for the 4-byte integer version of SCSL. When using the 8-byte integer version, the variables of type int become long long and the <scsl_fft_i8.h> header file should be included. DESCRIPTION These routines compute the correlation of the filter sequence h with each column of the two-dimentionsal data array x, producing the output two- dimensional array y. Suppose h is a sequence of nh elements and X is a 2D matrix with nseq columns, and nx elements in each column, as follows: h = [ h(0), h(1), ..., h(nh - 1) ] , and x(0, 0) x(0, 1) x(0, 2) ... x(0, nseq-1) x(1, 0) x(1, 1) x(1, 2) ... x(1, nseq-1) X = x(2, 0) x(2, 1) x(2, 2) ... x(2, nseq-1) ... ... ... ... ... x(nx-1, 0) x(nx-1, 1) x(nx-1, 2) ... x(nx-1, nseq-1) Then each column of the output matrix: y(0, 0) y(0, 1) y(0, 2) ... y(0, nseq-1) y(1, 0) y(1, 1) y(1, 2) ... y(1, nseq-1) Y = y(2, 0) y(2, 1) y(2, 2) ... y(2, nseq-1) ... ... ... ... ... y(ny-1, 0) y(ny-1, 1) y(ny-1, 2) ... y(ny-1, nseq-1) is obtained by correlating h with the corresponding column of X, so that: nh-1 y(i,j) = Sum {h(k)*x(i+k,j)}, 0<=i<nx, 0<=j<nseq k=0 The matrix Y has values defined for 0 <= i < nx and 0 <= j < nseq. In the *CORM1D routines, the number of terms in each output column is specified by an argument, ny. If ny < nx, the columns of y are truncated. If ny >= nx, the terms beyond y(nx-1,j) are set to 0. Generally, the sequences Cx(:,j), h and y(:,j) represent signals sampled at equal time intervals, and the indexes of the vectors denote the sample times. If the signals begin at the same time, we may, without loss of generality, set the initial time to 0, as in the formulas above. The *CORM1D routines, however, permit more generality than this. The signals may be time shifted from each other using input parameters specifiying the initial time sample for each signal. This can be useful in several situations. For example, if the input array has several leading zero values that one does not wish to store, ix0 may be set to the time sample corresponding to the first non-zero element in the columns of the input array, and earlier time samples are treated as 0. Note that, instead of 0, the initial time could just as easily have been labeled 1 or 10 or -78; the relevant point is that the first elements of each of the x, h and y arrays are defined to be the same time sample as long as ix0 = ih0 = iy0. See the NOTES section of this man page for information about the interpretation of the data types described in the following arguments. These routines have the following arguments: x Array of dimensions (ldx, nseq). (input). CCORM1D: Single precision complex array. ZCORM1D: Double precision complex array. SCORM1D: Single precision array. DCORM1D: Double precision array. Input sequences to be correlated with h. incx Integer. (input) Increment between two successive values of a sequence in x. incx must not be 0. ldx Integer. (input) The number of rows in x as it was declared in the calling program (the leading dimension of x). ldx >= MAX(nx * incx,1). ix0 Integer. (input) Sample corresponding to the first element of each 1D sequence of x. nx Integer. (input) Size of each sequence (the number of elements in each sequence of x). nx >= 0. nseq Integer. (input) The number of sequences to which the correlation will be applied. nseq >= 0. If nseq = 0, the routine returns. h Array of dimension nh. (input). CCORM1D: Single precision complex array. ZCORM1D: Double precision complex array. SCORM1D: Single precision array. DCORM1D: Double precision array. Input sequence to be correlated with x. inch Integer. (input) Increment between two successive values of h. inch must not be 0. ih0 Integer. (input) Sample corresponding to the first element of h. nh Integer. (input) The number of elements in the sequence h. nh >= 0. If nh = 0, the routine returns. y Array of dimensions (ldy, nseq). (output) CCORM1D: Single precision complex array. ZCORM1D: Double precision complex array. SCORM1D: Single precision array. DCORM1D: Double precision array. incy Integer. (input) Increment between two successive values of a sequence in y. incy must not be 0. ldy Integer. (input) The number of rows in y as it was declared in the calling program (the leading dimension of y). ldy >= MAX(ny * incy, 1). iy0 Integer. (input) Index of the first element of each 1D sequence of y. ny Integer. (input) Number of elements in each sequence of y. ny >= 0. If ny = 0, the routine returns. NOTES The following data types are described in this documentation: Term Used Data type Fortran: Array dimensioned 0..n-1 x(0:n-1) Array of dimensions (m,n) x(m,n) Array of dimensions (m,n,p) x(m,n,p) Integer INTEGER (INTEGER*8 for -lscs_i8[_mp]) Single precision REAL Double precision DOUBLE PRECISION Single precision complex COMPLEX Double precision complex DOUBLE COMPLEX C/C++: Array dimensioned 0..n-1 x[n] Array of dimensions (m,n) x[m*n] or x[n][m] Array of dimensions (m,n,p) x[m*n*p] or x[p][n][m] Integer int (long long for -lscs_i8[_mp]) Single precision float Double precision double Single precision complex scsl_complex Double precision complex scsl_zomplex C++ STL: Array dimensioned 0..n-1 x[n] Array of dimensions (m,n) x[m*n] or x[n][m] Array of dimensions (m,n,p) x[m*n*p] or x[p][n][m] Integer int (long long for -lscs_i8[_mp]) Single precision float Double precision double Single precision complex complex<float> Double precision complex complex<double> CAUTIONS The arrays x, h and y must be non-overlapping. EXAMPLES The following example computes the correlation of 5 4-sample sequences x with a filter h containing 3 samples: Fortran: REAL X(0:3,0:4), H(0:2), Y(0:5,0:4) DO J = 0, 4 X(0,J) = J + 1.0 DO I = 1, 3 X(I,J) = -1.0 - j ENDDO ENDDO DO I = 0, 2 H(I) = 1.0/(I+1) ENDDO CALL SCORM1D(X, 1, 4, 0, 4, 5, H, 1, 0, 3, Y, 1, 6, 0, 6) C/C++: #include <scsl_fft.h> float x[5][4], h[3], y[5][6]; int i, j; for (j=0; j<5; j++) { x[j][0] = j + 1.0f; for (i=1; i<4; i++) { x[j][i] = -1.0f - j; } } for (i=0; i<3; i++) { h[i] = 1.0f/(i+1); } scorm1d((float *) x, 1, 4, 0, 4, 5, h, 1, 0, 3, (float *) y, 1, 6, 0, 6); The output is Y(:,0) Y(:,1) Y(:,2) Y(:,3) Y(:,4) Y(0,:) 0.1667 0.3333 0.5000 0.6667 0.8333 Y(1,:) -1.8333 -3.6667 -5.5000 -7.3333 -9.1667 Y(2,:) -1.5000 -3.0000 -4.5000 -6.0000 -7.5000 Y(3,:) -1.0000 -2.0000 -3.0000 -4.0000 -5.0000 Y(4,:) 0.0000 0.0000 0.0000 0.0000 0.0000 Y(5,:) 0.0000 0.0000 0.0000 0.0000 0.0000 Changing the values for ix0, ih0 and iy0 produces the following shifts in the output: ix0 = +1 Y(:,0) Y(:,1) Y(:,2) Y(:,3) Y(:,4) Y(0,:) 0.1667 0.3333 0.5000 0.6667 0.8333 Y(1,:) 0.1667 0.3333 0.5000 0.6667 0.8333 Y(2,:) -1.8333 -3.6667 -5.5000 -7.3333 -9.1667 Y(3,:) -1.5000 -3.0000 -4.5000 -6.0000 -7.5000 Y(4,:) -1.0000 -2.0000 -3.0000 -4.0000 -5.0000 Y(5,:) 0.0000 0.0000 0.0000 0.0000 0.0000 ih0 = +1 Y(:,0) Y(:,1) Y(:,2) Y(:,3) Y(:,4) Y(0,:) -1.8333 -3.6667 -5.5000 -7.3333 -9.1667 Y(1,:) -1.5000 -3.0000 -4.5000 -6.0000 -7.5000 Y(2,:) -1.0000 -2.0000 -3.0000 -4.0000 -5.0000 Y(3,:) 0.0000 0.0000 0.0000 0.0000 0.0000 Y(4,:) 0.0000 0.0000 0.0000 0.0000 0.0000 Y(5,:) 0.0000 0.0000 0.0000 0.0000 0.0000 iy0 = -1 Y(:,0) Y(:,1) Y(:,2) Y(:,3) Y(:,4) Y(0,:) 0.1667 0.3333 0.5000 0.6667 0.8333 Y(1,:) 0.1667 0.3333 0.5000 0.6667 0.8333 Y(2,:) -1.8333 -3.6667 -5.5000 -7.3333 -9.1667 Y(3,:) -1.5000 -3.0000 -4.5000 -6.0000 -7.5000 Y(4,:) -1.0000 -2.0000 -3.0000 -4.0000 -5.0000 Y(5,:) 0.0000 0.0000 0.0000 0.0000 0.0000 SEE ALSO CCOR1D(3S), INTRO_FFT(3S), INTRO_SCSL(3S)