kml_csparse_?csrtrsv
Solve a system of 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 zero-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_csparse_scsrtrsv(const char uplo, const kml_sparse_operation_t opt, const kml_sparse_diag_type_t 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_csparse_dcsrtrsv(const char uplo, const kml_sparse_operation_t opt, const kml_sparse_diag_type_t 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_csparse_ccsrtrsv(const char uplo, const kml_sparse_operation_t opt, const kml_sparse_diag_type_t 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_csparse_zcsrtrsv(const char uplo, const kml_sparse_operation_t opt, const kml_sparse_diag_type_t 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 |
Whether the upper triangle or lower triangular part of matrix A is used.
|
Input |
|
opt |
Enumeration type kml_sparse_operation_t |
Operation on matrix A.
|
Input |
|
diag |
Enumeration type kml_sparse_diag_type_t |
Whether the diagonal element is a unit element.
|
Input |
|
m |
Integer |
Number of rows and columns in matrix A. The value range is [1, MAX_KML_INT]. |
Input |
|
a |
|
Non-zero elements in matrix A |
Input |
|
ia |
Integer array |
Vector whose length is m+1. ia[i] indicates the index of the first non-zero element in the i-th row of matrix A in the a array. |
Input |
|
ja |
Integer array |
ja[i] indicates the column number of the i-th element of the a array in matrix A. |
Input |
|
x |
|
Vector x. |
Input |
|
y |
|
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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
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] = {3, 0, 3, 1, 2, 2, 3, 3, 1}; KML_INT ia[5] = {0, 2, 5, 7, 9}; float x[4] = {6, 6, 4, 6}; float y[4] = {1, 1, 6, 1}; kml_sparse_status_t status = kml_csparse_scsrtrsv(uplo, opt, diag, m, val, ia, ja, x, y); /* * Output Y: * -3.000000 1.200000 0.500000 1.800000 * * */ |


