cfir1d man page on IRIX

Man page or keyword search:  
man Server   31559 pages
apropos Keyword Search (all sections)
Output format
IRIX logo
[printable version]



CFIR1D(3S)							    CFIR1D(3S)

NAME
     CFIR1D, ZFIR1D, SFIR1D, DFIR1D - Compute the 1D convolution of a sequence

SYNOPSIS
     Single precision complex

	  Fortran:
	       CALL CFIR1D (x, incx, ix0, nx, h, inch, ih0, nh, y, incy, iy0,
	       ny, alpha, beta)

	  C/C++:
	       #include <scsl_fft.h>
	       void cfir1d( scsl_complex *x, int incx, int ix0, int nx,
	       scsl_complex *h, int inch, int ih0, int nh, scsl_complex *y,
	       int incy, int iy0, int ny, scsl_complex *alpha, scsl_complex
	       *beta);

	  C++ STL:
	       #include <complex.h>
	       #include <scsl_fft.h>
	       void cfir1d( complex<float> *x, int incx, int ix0, int nx,
	       complex<float> *h, int inch, int ih0, int nh, complex<float>
	       *y, int incy, int iy0, int ny, complex<float> *alpha,
	       complex<float> *beta);

     Double precision complex

	  Fortran:
	       CALL ZFIR1D (x, incx, ix0, nx, h, inch, ih0, nh, y, incy, iy0,
	       ny, alpha, beta)

	  C/C++:
	       #include <scsl_fft.h>
	       void zfir1d( scsl_zomplex *x, int incx, int ix0, int nx,
	       scsl_zomplex *h, int inch, int ih0, int nh, scsl_zomplex *y,
	       int incy, int iy0, int ny, scsl_zomplex *alpha, scsl_zomplex
	       *beta);

	  C++ STL:
	       #include <complex.h>
	       #include <scsl_fft.h>
	       void zfir1d( complex<double> *x, int incx, int ix0, int nx,
	       complex<double> *h, int inch, int ih0, int nh, complex<double>
	       *y, int incy, int iy0, int ny, complex<double> *alpha,
	       complex<double> *beta);

     Single precision

	  Fortran:
	     CALL SFIR1D (x, incx, ix0, nx, h, inch, ih0, nh, y, incy, iy0,
	     ny, alpha, beta)

									Page 1

CFIR1D(3S)							    CFIR1D(3S)

	  C/C++:
	       #include <scsl_fft.h>
	       void sfir1d( float *x, int incx, int ix0, int nx, float *h, int
	       inch, int ih0, int nh, float *y, int incy, int iy0, int ny,
	       float alpha, float beta);

     Double precision

	  Fortran:
	     CALL DFIR1D (x, incx, ix0, nx, h, inch, ih0, nh, y, incy, iy0,
	     ny, alpha, beta)

	  C/C++:
	       #include <scsl_fft.h>
	       void dfir1d( double *x, int incx, int ix0, int nx, double *h,
	       int inch, int ih0, int nh, double *y, int incy, int iy0, int
	       ny, double alpha, double beta);

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 convolution of the finite impulse response
     filter h with a vector x, producing the output vector y.

	  y = beta * y + alpha * h * x

     Suppose h and x are two sequences of numbers having nh and nx elements
     respectively:

	  h = [h(0), h(1), , h(nh - 1) ] , and
	  x = [x(0), x(1), , x(nx - 1) ] .

     The convolution product, y = h*x, is the sequence that has nh + nx - 1
     non-zero elements defined by the following:

									Page 2

CFIR1D(3S)							    CFIR1D(3S)

		 nh-1
	  y(j) = Sum [h(k)x(j-k)] for j=0, ...,nx+nh-2
		 j=0

     y(0) = h(0)*x(0)
     y(1) = h(0)*x(1) + h(1)*x(0)
     y(2) = h(0)*x(2) + h(1)*x(1) + h(2)*x(0)

     y(nh-1) = h(0)*x(nh-1) + h(1)*x(nh-2) + ... + h(nh-1)*x(0)
				      ...
     y(j) = h(0)*x(j) + h(1)*x(j-1) + ... + h(nh-1)*x(j-nh+1)
				      ...
     y(nx-1) = h(0)*x(nx-1) + h(1)*x(nx-2) + ... + h(nh-1)*x(nx-nh)
				      ...
     y(nx+nh-3) = h(nh-2)*x(nx-1) + h(nh-1)*x(nx-2)
     y(nx+nh-2) = h(nh-1)*x(nx-1)

     In the *FIR1D routines, the number of terms in the output sequence is
     specified by an argument, ny.  If ny < nh + nx - 1 the sequence y is
     truncated.	 If ny > nh + nx - 1 the terms beyond y(nh + nx - 2) are set
     to 0.

     Generally, the sequences x, h and y represent signals sampled at equal
     time intervals, and the indexes of the vectors denote the sample times.
     If all three signals begin at the same time, we may, without loss of
     generality, set the initial time to 0, as in the formulas above.

     The *FIR1D 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 input
     array, and earlier time samples are treated as 0. Another use is to limit
     the output to just the "fully engaged" terms of the convolution.

     As can be seen above, when nx>= nh, the convolution has ramp-up and
     ramp-down regions in which fewer than all nh filter values contribute to
     the output value. Setting iy0 to nh-1 causes the first value output to
     correspond to time sample nh-1, thus skipping the ramp-up region.
     Setting ny to nx-nh+1 then drops the ramp-down terms, limiting the output
     to just the fully engaged part.

     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.

									Page 3

CFIR1D(3S)							    CFIR1D(3S)

     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 dimension nx. (input).
	       CFIR1D: Single precision complex array.
	       ZFIR1D: Double precision complex array.
	       SFIR1D: Single precision array.
	       DFIR1D: Double precision array.
	       Input sequences to be convolved with h.

     incx      Integer. (input)
	       The increment between two successive values of x.  incx must
	       not be 0.

     ix0       Integer. (input)
	       Time sample corresponding to the first element of x.

     nx	       Integer. (input)
	       The number of elements in the sequence x.  nx >= 0.

     h	       Array of dimension nh. (input).
	       CFIR1D: Single precision complex array.
	       ZFIR1D: Double precision complex array.
	       SFIR1D: Single precision array.
	       DFIR1D: Double precision array.
	       Input sequence to be convolved with x.

     inch      Integer.	 (input)
	       Increment between two successive values of h. inch must not be
	       0.

     ih0       Integer.	 (input)
	       Time sample corresponding to the first element of h.

     nh	       Integer.	 (input)
	       The number of elements in the sequence h.  nh >= 0.

     y	       Array of dimension ny.  (input and output).
	       CFIR1D: Single precision complex array.
	       ZFIR1D: Double precision complex array.
	       SFIR1D: Single precision array.
	       DFIR1D: Double precision array.
	       Output of the FIR filter.  On entry, the array y must have been
	       initialized, except except when beta is 0; in that case, y need
	       not be initialized.  On exit, the result overwrites y.

     incy      Integer.	 (input)
	       Increment between two successive values of y.  incy must not be
	       0.

									Page 4

CFIR1D(3S)							    CFIR1D(3S)

     iy0       Integer.	 (input)
	       Time sample corresponding to the first element of y.

     ny	       Integer.	 (input)
	       Number of elements in the sequence y.  ny >= 0.

     alpha     Scale factor for the convolution.  (input).
	       CFIR1D: Single precision complex.
	       ZFIR1D: Double precision complex.
	       SFIR1D: Single precision.
	       DFIR1D: Double precision.
	       For C/C++, a pointer to this value is passed.

     beta      Scale factor for the output y. (input)
	       CFIR1D: Single precision complex.
	       ZFIR1D: Double precision complex.
	       SFIR1D: Single precision.
	       DFIR1D: Double precision.
	       When beta is supplied as 0, y need not be set on input.	For
	       C/C++, a pointer to this value is passed.

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]

									Page 5

CFIR1D(3S)							    CFIR1D(3S)

	  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 convolution of a 4-sample sequence x
     with a filter h containing 3 samples.

     Fortran:

	   REAL X(0:3), H(0:2), Y(0:5)
	   REAL ALPHA, BETA
	   ALPHA = 1.0
	   BETA	 = 0.0

	   X(0) = 1.0
	   DO I = 1, 3
	     X(I) = -1.0
	   ENDDO
	   DO I = 0, 2
	      H(I) = 1.0/(I+1)
	   ENDDO
	   CALL SFIR1D(X(0), 1, 0, 4, H(0), 1, 0, 3, Y(0), 1, 0, 6,

									Page 6

CFIR1D(3S)							    CFIR1D(3S)

	  &	       ALPHA, BETA)

     C/C++:

	  #include <scsl_fft.h>
	  float x[4], h[3], y[6];
	  float alpha = 1.0f;
	  float beta  = 0.0f;
	  int i;

	  x[0] = 1.0f
	  for (i=1; i<4; i++) {
	       x[i] = -1.0f;
	  }
	  for (i=0; i<3; i++) {
	      h[i] = 1.0f/(i+1);
	  }
	  sfir1d(x, 1, 0, 4, h, 1, 0, 3, y, 1, 0, 6, alpha, beta);

     The output is the following:

			Y(0)	 Y(1)	  Y(2)	   Y(3)	    Y(4)     Y(5)
		      1.0000  -0.5000  -1.1667	-1.8333	 -0.8333  -0.3333

     Changing the values for ix0, ih0 and iy0 produces the following shifts in
     the output:

			Y(0)	 Y(1)	  Y(2)	   Y(3)	    Y(4)     Y(5)
	  ix0 = +1:   0.0000   1.0000  -0.5000	-1.1667	 -1.8333  -0.8333
	  ix0 = +2:   0.0000   0.0000	1.0000	-0.5000	 -1.1667  -1.8333
	  ix0 = -1:  -0.5000  -1.1667  -1.8333	-0.8333	 -0.3333   0.0000
	  ix0 = -2:  -1.1667  -1.8333  -0.8333	-0.3333	  0.0000   0.0000
	  ih0 = +1:   0.0000   1.0000  -0.5000	-1.1667	 -1.8333  -0.8333
	  ih0 = +2:   0.0000   0.0000	1.0000	-0.5000	 -1.1667  -1.8333
	  ih0 = -1:  -0.5000  -1.1667  -1.8333	-0.8333	 -0.3333   0.0000
	  ih0 = -2:  -1.1667  -1.8333  -0.8333	-0.3333	  0.0000   0.0000
	  iy0 = +1:  -0.5000  -1.1667  -1.8333	-0.8333	 -0.3333   0.0000
	  iy0 = +2:  -1.1667  -1.8333  -0.8333	-0.3333	  0.0000   0.0000
	  iy0 = -1:   0.0000   1.0000  -0.5000	-1.1667	 -1.8333  -0.8333
	  iy0 = -2:   0.0000   0.0000	1.0000	-0.5000	 -1.1667  -1.8333


SEE ALSO
     INTRO_FFT(3S), INTRO_SCSL(3S)

									Page 7

[top]

List of man pages available for IRIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net