IBM Books

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

SSCTR, DSCTR, CSCTR, ZSCTR--Scatter the Elements of a Sparse Vector X in Compressed-Vector Storage Mode into Specified Elements of a Sparse Vector Y in Full-Vector Storage Mode

These subprograms scatter the elements of sparse vector x, stored in compressed-vector storage mode, into specified elements of sparse vector y, stored in full-vector storage mode.

Table 57. Data Types

x, y Subprogram
Short-precision real SSCTR
Long-precision real DSCTR
Short-precision complex CSCTR
Long-precision complex ZSCTR

Syntax

Fortran CALL SSCTR | DSCTR | CSCTR | ZSCTR (nz, x, indx, y)
C and C++ ssctr | dsctr | csctr | zsctr (nz, x, indx, y);
PL/I CALL SSCTR | DSCTR | CSCTR | ZSCTR (nz, x, indx, y);

On Entry

nz
is the number of elements in sparse vector x, stored in compressed-vector storage mode. Specified as: a fullword integer; nz >= 0.

x
is the sparse vector x, containing nz elements, stored in compressed-vector storage mode in an array, referred to as X. Specified as: a one-dimensional array of (at least) length nz, containing numbers of the data type indicated in Table 57.

indx
is the array, referred to as INDX, containing the nz indices that indicate the positions of the elements of the sparse vector x when in full-vector storage mode. They also indicate the positions in vector y into which the elements are copied.

Specified as: a one-dimensional array of (at least) length nz, containing fullword integers.

y
See On Return.

On Return

y
is the sparse vector y, stored in full-vector storage mode, of (at least) length max(INDX(i)) for i = 1, nz, into which nz elements of vector x are copied at positions indicated by the indices array INDX.

Returned 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 57.

Notes
  1. Each value specified in array INDX must be unique; otherwise, results are unpredictable.
  2. Vectors x and y must have no common elements; otherwise, results are unpredictable. See Concepts.
  3. For a description of how sparse vectors are stored, see Sparse Vector.

Function

The copy is expressed as follows:

yINDX(i) <-- xi    for i = 1, nz

where:

x is a sparse vector, stored in compressed-vector storage mode.
INDX is the indices array for sparse vector x.
y is a sparse vector, stored in full-vector storage mode.

See reference [29]. If nz is 0, no copy is performed.

Error Conditions

Computational Errors

None

Input-Argument Errors

nz < 0

Example 1

This example shows how to use SSCTR to copy a sparse vector x of length 5 into the following vector y, where the elements of array INDX are in ascending order:

          Y = (6.0, 2.0, 4.0, 7.0, 6.0, 10.0, -2.0, 8.0, 9.0, 0.0 )

Call Statement and Input
            NZ  X   INDX   Y
            |   |    |     |
CALL SSCTR( 5 , X , INDX , Y )
 
X        =  (1.0, 2.0, 3.0, 4.0, 5.0)
INDX     =  (1, 3, 4, 7, 10)

Output
Y        =  (1.0, 2.0, 2.0, 3.0, 6.0, 10.0, 4.0, 8.0, 9.0, 5.0)

Example 2

This example shows how to use SSCTR to copy a sparse vector x of length 5 into the following vector y, where the elements of array INDX are in random order:

         Y = (6.0, 2.0, 4.0, 7.0, 6.0, 10.0, -2.0, 8.0, 9.0, 0.0 )

Call Statement and Input
            NZ  X   INDX   Y
            |   |    |     |
CALL SSCTR( 5 , X , INDX , Y )
 
X        =  (1.0, 2.0, 3.0, 4.0, 5.0)
INDX     =  (4, 3, 1, 10, 7)

Output
Y        =  (3.0, 2.0, 2.0, 1.0, 6.0, 10.0, 5.0, 8.0, 9.0, 4.0)

Example 3

This example shows how to use CSCTR to copy a sparse vector x of length 3 into the following vector y, where the elements of array INDX are in random order:

         Y = ((6.0, 5.0), (-2.0, 3.0), (15.0, 4.0), (9.0, 0.0))

Call Statement and Input
            NZ  X   INDX   Y
            |   |    |     |
CALL CSCTR( 3 , X , INDX , Y )
 
X        =  ((1.0, 2.0), (3.0, 4.0), (5.0, 6.0))
INDX     =  (4, 1, 3)

Output
Y        =  ((3.0, 4.0), (-2.0, 3.0), (5.0, 6.0), (1.0, 2.0))


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