Rate This Document
Findability
Accuracy
Completeness
Readability

kml_sparse_?csrtrsv

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

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

A is a sparse matrix stored in the CSR format (3-array variation), x and y are vectors, and only one-based indexing is supported. The non-zero elements of a given row in matrix A must be stored in the same order as they are displayed in the row (from left to right).

Interface Definition

C interface:

kml_sparse_status_t kml_sparse_scsrtrsv(const char uplo, const kml_sparse_operation_t opt, const char diag, const KML_INT m, const float *a, const KML_INT *ia, const KML_INT *ja, const float *x, float *y);

kml_sparse_status_t kml_sparse_dcsrtrsv(const char uplo, const kml_sparse_operation_t opt, const char diag, const KML_INT m, const double *a, const KML_INT *ia, const KML_INT *ja, const double *x, double *y);

kml_sparse_status_t kml_sparse_ccsrtrsv(const char uplo, const kml_sparse_operation_t opt, const char *diag, const KML_INT m, const KML_Complex8 *a, const KML_INT *ia, const KML_INT *ja, const KML_Complex8 *x, KML_Complex8 *y);

kml_sparse_status_t kml_sparse_zcsrtrsv(const char uplo, const kml_sparse_operation_t opt, const char *diag, const KML_INT m, const KML_Complex16 *a, const KML_INT *ia, const KML_INT *ja, const KML_Complex16 *x, KML_Complex16 *y);

Parameters

Parameter

Type

Description

Input/Output

uplo

Enumeration type kml_sparse_fill_mode_t uplo

Indicates whether the upper triangle or lower triangle of matrix A is used.

  • U: upper triangle
  • L: lower triangle

Input

opt

Enumeration type kml_sparse_operation_t

Operation on matrix A.

  • If opt = KML_SPARSE_OPERATION_NON_TRANSPOSE, then .
  • If opt = KML_SPARSE_OPERATION_TRANSPOSE, then .
  • If opt = KML_SPARSE_OPERATION_CONJUGATE_TRANSPOSE, then .

Input

diag

Enumeration type kml_sparse_diag_type_t

Whether the diagonal element is a unit element.

U: unit element

N: non-unit element

Input

m

Integer

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

Input

a

  • For scsrtrsv, val is a single-precision floating-point array.
  • For dcsrtrsv, val is a double-precision floating-point array.
  • For ccsrtrsv, val is a single-precision complex number array.
  • For zcsrtrsv, val is a double-precision complex number array.

Non-zero elements in matrix A

Input

ia

Integer array

Vector whose length is m+1.

ia[i]-1 indicates the index of the first non-zero element in the ith row of matrix A in the val array.

Input

ja

Integer array

ja[i] indicates the column number of the ith element of the val array in matrix A.

Input

x

  • For scsrtrsv, x is a single-precision floating-point array.
  • For dcsrtrsv, x is a double-precision floating-point array.
  • For ccsrtrsv, x is a single-precision complex number array.
  • For zcsrtrsv, x is a double-precision complex number array.

Vector x

Input

y

  • For scsrtrsv, y is a single-precision floating-point array.
  • For dcsrtrsv, y is a double-precision floating-point array.
  • For ccsrtrsv, y is a single-precision complex number array.
  • For zcsrtrsv, 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 ia and ja 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_fill_mode_t uplo = KML_SPARSE_FILL_MODE_LOWER;
kml_sparse_diag_type_t diag = KML_SPARSE_DIAG_NON_UNIT;
kml_sparse_operation_t opt = KML_SPARSE_OPERATION_NON_TRANSPOSE;
KML_INT m = 4;
float val[9] = {2, -2, 1, 5, 3, 8, 6, 2, 2};
KML_INT ja[9] = {4, 1, 4, 2, 3, 3, 4, 4, 2};
KML_INT ia[5] = {1, 3, 6, 8, 10};
float x[4] = {6, 6, 4, 6};
float y[4] = {1, 1, 6, 1};
kml_sparse_status_t status = kml_sparse_scsrtrsv(uplo, opt, diag, m, val, ia, ja, x, y);
/*
*  Output Y:
*     -3.000000 1.200000 0.500000 1.800000
*
* */