Rate This Document
Findability
Accuracy
Completeness
Readability

kml_sparse_?cscsv

Solve a system of equations for a triangular sparse matrix that is stored in the CSC format. The operation is defined as follows:

  • A * y = alpha * x
  • AT * y = alpha * x
  • AH * y = alpha * x

x and y are vectors, and A is a sparse matrix (m * m) in the CSC format. The non-zero elements of a given column in matrix A must be stored in the same order as they are displayed in the column (from top to bottom).

Interface Definition

C interface:

kml_sparse_status_t kml_sparse_scscsv(const kml_sparse_operation_t opt, const KML_INT m, const float alpha, const char *matdescra, const float *val, const KML_INT *indx, const KML_INT *pntrb, const KML_INT *pntre, const float *x, const float beta, float *y);

kml_sparse_status_t kml_sparse_dcscsv(const kml_sparse_operation_t opt, const KML_INT m, const double alpha, const char *matdescra, const double *val, const KML_INT *indx, const KML_INT *pntrb, const KML_INT *pntre, const double *x, const double beta, double *y);

kml_sparse_status_t kml_sparse_ccscsv(const kml_sparse_operation_t opt, const KML_INT m, const KML_Complex8 alpha, const char *matdescra, const KML_Complex8 *val, const KML_INT *indx, const KML_INT *pntrb, const KML_INT *pntre, const KML_Complex8 *x, const KML_Complex8 beta, KML_Complex8 *y);

kml_sparse_status_t kml_sparse_zcscsv(const kml_sparse_operation_t opt, const KML_INT m, const KML_Complex16 alpha, const char *matdescra, const KML_Complex16 *val, const KML_INT *indx, const KML_INT *pntrb, const KML_INT *pntre, const KML_Complex16 *x, const KML_Complex16 beta, KML_Complex16 *y);

Parameters

Parameter

Type

Description

Input/Output

opt

Enumeration type kml_sparse_operation_t

Operation on matrix A.

  • If opt=KML_SPARSE_OPERATION_NON_TRANSPOSE, then A * y = alpha * x.
  • If opt=KML_SPARSE_OPERATION_TRANSPOSE, then AT * y = alpha * x.
  • If opt=KML_SPARSE_OPERATION_CONJUGATE_TRANSPOSE, then AH * y = alpha * x.

Input

m

Integer

Number of rows in matrix A. The value range is [1, MAX_KML_INT].

Input

alpha

  • For scscsv, alpha is of the single-precision floating-point type.
  • For dcscsv, alpha is of the double-precision floating-point type.
  • For ccscsv, alpha is a single-precision complex number.
  • For zcscsv, alpha is a double-precision complex number.

Coefficient

Input

matdescra

Char pointer

Matrix operation attribute. For details, see the description of matdescra.

Input

val

  • For scscsv, val is a single-precision floating-point array.
  • For dcscsv, val is a double-precision floating-point array.
  • For ccscsv, val is a single-precision complex number array.
  • For zcscsv, val is a double-precision complex number array.

Non-zero elements in matrix A

Input

indx

Integer array

indx[i] indicates the row number of the ith element of the val array in matrix A.

Input

pntrb

Integer array

Array of length m, containing column indices of matrix A. pntrb[i] - pntrb[0] indicates the subscript of the first non-zero element in column i in the val and indx arrays.

Input

pntre

Integer array

Array of length m, containing column indices of matrix A. pntre[i] - pntrb[0]-1 indicates the subscript of the last non-zero element in column i in the val and indx arrays.

Input

x

  • For scscsv, x is a single-precision floating-point array.
  • For dcscsv, x is a double-precision floating-point array.
  • For ccscsv, x is a single-precision complex number array.
  • For zcscsv, x is a double-precision complex number array.

Vector x

Input

y

  • For scscsv, y is a single-precision floating-point array.
  • For dcscsv, y is a double-precision floating-point array.
  • For ccscsv, y is a single-precision complex number array.
  • For zcscsv, y is a double-precision complex number array.

Vector y.

This parameter is output after update.

Input/Output

The function does not verify the integrity of parameters. Ensure that the elements in pntrb and pntre do not exceed the maximum index value of the input matrix.

Return Value

Function execution status. The enumeration type is kml_sparse_status_t.

Dependencies

C: "kspblas.h"

Fortran: "kspblas.f03"

Examples

C interface:

kml_sparse_operation_t opt = KML_SPARSE_OPERATION_NON_TRANSPOSE;
char *matdescra = "TLNC";
KML_INT m = 4;
float alpha = 1.0;
float val[9] = {2, 3, 1, 5, 7, 8, 3, 6, 7};
KML_INT indx[9] = {0, 1, 2, 1, 1, 2, 3, 0, 3};
KML_INT pntrb[4] = {0, 3, 4, 7};
KML_INT pntre[4] = {3, 4, 7, 9};
float x[4] = {6, 6, 4, 6};
float y[4] = {1, 1, 6, 1};
kml_sparse_status_t status = kml_sparse_scscsv(opt, m, alpha, matdescra, val, indx, pntrb, pntre, x, y);
/*
*  Output Y:
*     3.000000 -0.600000 0.125000 0.803571
*
* */