IBM Books

Engineering and Scientific Subroutine Library for AIX Version 3 Release 3: Guide and Reference

STREC and DTREC--Time-Varying Recursive Filter

These subroutines implement the first-order time-varying recursive equation, using initial value s, target vectors u and x, and output vector y.

Table 145. Data Types

s, u, x, y Subroutine
Short-precision real STREC
Long-precision real DTREC

Syntax

Fortran CALL STREC | DTREC (s, u, incu, x, incx, y, incy, n , iopt)
C and C++ strec | dtrec (s, u, incu, x, incx, y, incy, n, iopt);
PL/I CALL STREC | DTREC (s, u, incu, x, incx, y, incy, n , iopt);

On Entry

s
is the scalar s used in the initial computation for y1. Specified as: a number of the data type indicated in Table 145.

u
is the target vector u of length n. Specified as: a one-dimensional array of (at least) length 1+(n-1)|incu|, containing numbers of the data type indicated in Table 145.

incu
is the stride for target vector u. Specified as: a fullword integer. It can have any value.

x
is the target vector x of length n. Specified as: a one-dimensional array of (at least) length 1+(n-1)|incx|, containing numbers of the data type indicated in Table 145.

incx
is the stride for target vector x. Specified as: a fullword integer. It can have any value.

y
See On Return.

incy
is the stride for output vector y. Specified as: a fullword integer; incy > 0 or incy < 0.

n
is the number of elements in vectors u and x and the number of resulting elements in output vector y. Specified as: a fullword integer; n >= 0.

iopt
this argument has no effect on the performance of the computation, but still must be specified as: a fullword integer; iopt = 0 or 1.

On Return

y
is the vector y of length n, containing the results of the implementation of the first-order time-varying recursive equation. Returned as: a one-dimensional array of (at least) length 1+(n-1)|incy|, containing numbers of the data type indicated in Table 145.

Note

Vectors u, x, and y must have no common elements; otherwise, results are unpredictable. See Concepts.

Function

The first-order time-varying recursive equation is expressed as follows:

y1 = s+u1x1
y2 = u2y1+u1x2
.
.
.
yi = uiyi-1+u1xi for i = 3, 4, ..., n

STREC provides the same function as the IBM 3838 function REC, with restrictions removed. DTREC provides a long-precision computation that is not included in the IBM 3838 functions. See the IBM 3838 Array Processor Functional Characteristics manual.

Error Conditions

Computational Errors

None

Input-Argument Errors
  1. incy = 0
  2. n < 0
  3. iopt <> 0 or 1

Example 1

This example shows all strides INCU, INCX, and INCY equal to 1 for vectors u, x, and y, respectively.

Call Statement and Input
             S    U  INCU  X  INCX  Y  INCY  N  IOPT
             |    |   |    |   |    |   |    |   |
CALL STREC( 1.0 , U , 1  , X , 1  , Y , 1  , 8 , 0 )
 
U        =  (1.0, 2.0, 3.0, 3.0, 2.0, 1.0, 1.0, 2.0)
X        =  (3.0, 2.0, 1.0, 1.0, 2.0, 3.0, 3.0, 2.0)

Output
Y        =  (4.0, 10.0, 31.0, 94.0, 190.0, 193.0, 196.0, 394.0)

Example 2

This example shows a stride, INCU, that is greater than 1 for vector u. The strides INCX and INCY for vectors x and y, respectively, are 1.

Call Statement and Input
             S    U  INCU  X  INCX  Y  INCY  N  IOPT
             |    |   |    |   |    |   |    |   |
CALL STREC( 1.0 , U , 2  , X , 1  , Y , 1  , 4 , 0 )
 
U        =  (1.0, . , 3.0, . , 2.0, . , 1.0, . )
X        =  (3.0, 2.0, 1.0, 1.0, 2.0, 3.0, 3.0, 2.0)

Output
Y        =  (4.0, 14.0, 29.0, 30.0)

Example 3

This example shows a stride, INCU, of 1 for vector u, a stride, INCX, that is greater than 1 for vector x, and a negative stride, INCY, for vector y. For y, results are stored beginning at element Y(4).

Call Statement and Input
             S    U  INCU  X  INCX  Y  INCY  N  IOPT
             |    |   |    |   |    |    |   |   |
CALL STREC( 1.0 , U , 1  , X , 2  , Y , -1 , 4 , 1 )
 
U        =  (1.0, 2.0, 3.0, 3.0, 2.0, 1.0, 1.0, 2.0)
X        =  (3.0, . , 1.0, . , 2.0, . , 3.0)

Output
Y        =  (90.0, 29.0, 9.0, 4.0)


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]