![](/images/backgrounds/286162/hp-hp-ux-performance-tools-users-manual-156076166x1.png)
SSCTR/DSCTR/ISCTR/CSCTR/ZSCTR | Scatter sparse vector | |
| indx | Array containing the indices {ki} of the interesting |
|
| elements of x. The indices must satisfy the following: |
|
| 1 ≤ indx(i) ≤ n, i = 1, 2, …, m |
|
| indx(i) ≠ indx( j), 1 ≤ i ≠ j ≤ m |
|
| where n is the length of y. |
Output | y | Array containing the elements of y, y(i) = yi. If m ≤ 0, |
|
| then y is unchanged. Otherwise, only the elements of y |
|
| whose indices are included in indx are changed. |
Notes The result is unspecified if any element of indx is out of range, if any two elements of indx have the same value, or if x, indx, and y overlap such that any element of x or any index shares a memory location with any element of y.
Fortran Equivalent
SUBROUTINE SSCTR (M, X,INDX, Y) REAL*4 X(*),Y(*)
INTEGER*4 INDX(*)
IF ( M .LE. 0 ) RETURN DO 10 I = 1, M
Y(INDX(I)) = X(I)
10CONTINUE RETURN END
Example Scatter x into y, where x is a sparse vector with interesting elements x1, x4, x5, and x9 stored in
INTEGER*4 | M,INDX(4) |
REAL*8 | X(4),Y(20) |
DATA | INDX / 1, 4, 5, 9 / |
M = 4 |
|
CALL DSCTR (M,X,INDX,Y)
138HP MLIB User’s Guide