These subroutines find the position of the i-th zero crossing in
vector x. This is the i-th transition between
positive and negative or negative and positive, where 0 is considered a
positive value. It returns the position of the element in vector
x where the i-th zero crossing is detected. The
direction of the scan is either from the first element to the last or from the
last element to the first, depending on the value you specify for the scan
direction argument.
x | Subroutine |
---|---|
Short-precision real | SIZC |
Long-precision real | DIZC |
Fortran | CALL SIZC | DIZC (x, idrx, n, i, ky) |
C and C++ | sizc | dizc (x, idrx, n, i, ky); |
PL/I | CALL SIZC | DIZC (x, idrx, n, i, ky); |
If the i-th zero crossing is found:
If the i-th zero crossing is not found:
Returned as: an array of (at least) length 2, containing fullword integers.
The aux and naux arguments, required in some earlier releases of ESSL, are no longer required by these subroutines. If your program still includes them, you do not have to change your program; it continues to run normally. It ignores these arguments. However, if you did any program checking for error code 2015, you may want to remove it, because this error no longer occurs. (You must not code these arguments in your C program.)
The i-th zero crossing in vector x is found by scanning vector x for i occurrences of TRUE for the following logical expressions. A zero crossing is defined here as a crossing either from a positive value to a negative value or from a negative value to a positive value, where 0 is considered a positive value. If the i-th zero crossing is found, the value of j at that point is returned in ky1 as the position of the i-th zero crossing, and i is returned in ky2.
If idrx >= 0:
If idrx < 0:
If the position of the i-th zero crossing is not found, 0 is returned in y1 and the number of zero crossings encountered in the scan is returned in y2.
SIZC provides the same functions as the IBM 3838 functions NZCP and NZCN, with restrictions removed. It combines these functions into one ESSL subroutine. DIZC provides a long-precision computation that is not included in the IBM 3838 functions. See the IBM 3838 Array Processor Functional Characteristics manual.
None
This example shows a scan of a vector x from the first element to the last. It is looking for the fifth zero crossing, which is encountered at position 9.
X IDRX N I KY | | | | | CALL SIZC( X , 1 , 12 , 5 , KY ) X = (2.0, -1.0, -3.0, 3.0, 0.0, 8.0, -2.0, 0.0, -5.0, -3.0, 2.0, -9.0)
KY = (9, 5)
This example shows a scan of a vector x from the last element to the first. It is looking for the seventh zero crossing, which is encountered at position 3. Because IDRX is negative, X is scanned from the last element, X(12), to the first element, X(1).
X IDRX N I KY | | | | | CALL SIZC( X , -1 , 12 , 7 , KY ) X = (2.0, -1.0, 3.0, -3.0, 0.0, -8.0, -2.0, 0.0, -5.0, -3.0, 2.0, -9.0)
KY = (3, 7)
This example shows a scan of a vector x when the i-th zero crossing is not found. It encounters seven zero crossings and returns this value in KY(2).
X IDRX N I KY | | | | | CALL SIZC( X , 1 , 12 , 10 , KY ) X = (2.0, -1.0, -3.0, 3.0, 0.0, 8.0, -2.0, 0.0, -5.0, -3.0, 2.0, -9.0)
KY = (0, 7)