{S,D,C,Z}GTHRZ ( nz, y, x, indx )
nz integer*4 On entry, the number of elements to be gathered into the compressed form. On exit, nz is unchanged. y real*4 | real*8 | complex*8 | complex*16 On entry, an array of the elements of vector y stored in full form. On exit, if nz <= 0, y is unchanged. If nz > 0, the gathered elements in Y are set to zero. Only the elements in the vector y corresponding to the indices in the INDX array are overwritten. x real*4 | real*8 | complex*8 | complex*16 On entry, an array that receives the specified elements of vector y. On exit, if nz <= 0 x is unchanged. If nz > 0, the array X contains the values gathered into compressed form. indx integer*4 On entry, an array containing the indices of the values to be gathered into compressed form. The values in INDX must be distinct for consistent vector or parallel execution. On exit, indx is unchanged.
The _GTHRZ subprograms gather the specified elements from a vector y stored in full form into a sparse vector x in compressed form. Those elements in y are then set to zero. For i=1, ..., nz: x(i) = y(indx(i)) y(indx (i)) = 0.0 If nz <= 0, both x and y are unchanged. SGTHRZ and DGTHRZ gather the specified elements of a real vector in full form into a real sparse vector in compressed form. CGTHRZ and ZGTHRZ gather the specified elements of a complex vector in full form into a complex sparse vector in compressed form. In each case, the specified elements of the full vector are set equal to zero.
INTEGER NZ, INDX(10) REAL*4 Y(40), X(10) NZ = 10 CALL SGTHRZ(NZ, Y, X, INDX) This FORTRAN code shows how the nz elements of the vector y, corresponding to the indices in the INDX array, are gathered in a compressed form into the vector x. The gathered elements in y are set equal to zero.