Rate This Document
Findability
Accuracy
Completeness
Readability

kml_sparse_?sctr

That is, y[indx[i]] = x[i], i=0,1,…nz-1.

Interface Definition

C interface:

kml_sparse_status_t kml_sparse_ssctr(const KML_INT nz, const float *x, const KML_INT *indx, float *y);

kml_sparse_status_t kml_sparse_dsctr(const KML_INT nz, const double *x, const KML_INT *indx, double *y);

kml_sparse_status_t kml_sparse_csctr(const KML_INT nz, const KML_Complex8 *x, const KML_INT *indx, KML_Complex8 *y);

kml_sparse_status_t kml_sparse_zsctr(const KML_INT nz, const KML_Complex16 *x, const KML_INT *indx, KML_Complex16 *y);

Fortran interface:

RES = KML_SPARSE_SSCTR(NZ, X, INDX, Y);

RES = KML_SPARSE_DSCTR(NZ, X, INDX, Y);

RES = KML_SPARSE_CSCTR(NZ, X, INDX, Y);

RES = KML_SPARSE_ZSCTR(NZ, X, INDX, Y);

Parameters

Parameter

Type

Description

Input/Output

nz

Integer

Number of elements in the x and indx arrays.

Input

y

  • For ssctr, y is a single-precision floating-point array.
  • For dsctr, y is a double-precision floating-point array.
  • For csctr, y is a single-precision complex array.
  • For zsctr, y is a double-precision complex array.

Array y. The size is at least max(indx[i]).

Input/Output

x

  • For ssctr, x is a single-precision floating-point array.
  • For dsctr, x is a double-precision floating-point array.
  • For csctr, x is a single-precision complex array.
  • For zsctr, x is a double-precision complex array.

Array x for storing non-zero elements. The size is at least nz.

Input

indx

Integer array

indx[i] indicates the serial number of the i-th element in the x array in the dense vector. The array size is at least nz.

Input

Return Value

Function execution status. The enumeration type is kml_sparse_status_t.

Dependencies

C: "kspblas.h"

Fortran: "kspblas.f03"

Examples

C interface:

    KML_INT nz = 2; 
    KML_INT indx[2] = {1, 2}; 
    float x[2] = {1, 1}; 
    float y[4] = {-1, 5, -2 ,3}; 
    kml_sparse_status_t status = kml_sparse_ssctr(nz, x, indx, y); 
 
    /* 
     *  Output sctr: 
     *     -1.000000     1.000000     1.000000     3.000000 
     */

Fortran interface:

    INTEGER(C_INT) :: NZ = 2 
    INTEGER(C_INT) :: INDX(2) 
    REAL(C_FLOAT) :: X(2), Y(4) 
    INTEGER(C_INT) :: STATUS 
    DATA INDX/1, 2/ 
    DATA X/1, 1/ 
    DATA Y/-1, 5, -2 ,3/ 
    STATUS = KML_SPARSE_SSCTR(NZ, X, INDX, Y) 
    ! 
    !  OUTPUT SCTR: 
    !     -1.000000     1.000000     1.000000     3.000000 
    !