These subprograms gather specified elements of vector y, stored
in full-vector storage mode, into sparse vector x, stored in
compressed-vector storage mode.
x, y | Subprogram |
Short-precision real | SGTHR |
Long-precision real | DGTHR |
Short-precision complex | CGTHR |
Long-precision complex | ZGTHR |
Fortran | CALL SGTHR | DGTHR | CGTHR | ZGTHR (nz, y, x, indx) |
C and C++ | sgthr | dgthr | cgthr | zgthr (nz, y, x, indx); |
PL/I | CALL SGTHR | DGTHR | CGTHR | ZGTHR (nz, y, x, indx); |
Specified as: a one-dimensional array of (at least) length max(INDX(i)) for i = 1, nz, containing numbers of the data type indicated in Table 58.
Specified as: a one-dimensional array of (at least) length nz, containing fullword integers.
Returned as: a one-dimensional array of (at least) length nz, containing numbers of the data type indicated in Table 58.
The copy is expressed as follows:
xi <-- yINDX(i) for i = 1, nz
where:
See reference [29]. If nz is 0, no copy is performed.
None
nz < 0
This example shows how to use SGTHR to copy specified elements of a vector y into a sparse vector x of length 5, where the elements of array INDX are in ascending order.
NZ Y X INDX | | | | CALL SGTHR( 5 , Y , X , INDX ) Y = (6.0, 2.0, 4.0, 7.0, 6.0, 10.0, -2.0, 8.0, 9.0, 0.0) INDX = (1, 3, 4, 7, 9)
X = (6.0, 4.0, 7.0, -2.0, 9.0)
This example shows how to use SGTHR to copy specified elements of a vector y into a sparse vector x of length 5, where the elements of array INDX are in random order. (Note that the element 0.0 occurs in output vector x. This does not produce an error.)
NZ Y X INDX | | | | CALL SGTHR( 5 , Y , X , INDX ) Y = (6.0, 2.0, 4.0, 7.0, 6.0, 10.0, -2.0, 8.0, 9.0, 0.0) INDX = (4, 3, 1, 10, 7)
X = (7.0, 4.0, 6.0, 0.0, -2.0)
This example shows how to use CGTHR to copy specified elements of a vector, y, into a sparse vector, x, of length 3, where the elements of array INDX are in random order.
NZ Y X INDX | | | | CALL CGTHR( 3 , Y , X , INDX ) Y = ((6.0, 5.0), (-2.0, 3.0), (15.0, 4.0), (9.0, 0.0)) INDX = (4, 1, 3)
X = ((9.0, 0.0), (6.0, 5.0), (15.0, 4.0))