KmlIssGcrSpmv
Compute the sparse matrix-vector multiplication in the GCR algorithm.
Interface Definition
C interface:
int KmlIssGcrSpmv(const float *a, const float *x, float *b, const int *xl, const int *xr, const int *yl, const int *yr, const int *zl, const int *ybegin, const int *yend, const int *zbegin, const int *zend);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
a |
const float * |
Matrix a, which is stored in the (z, x, y) direction. |
Input |
x |
const float * |
Vector x, which is stored in the (z, x, y) direction. |
Input |
b |
double * |
Computing result b. |
Input/Output |
xl |
const int * |
Start position in the x direction of the solving space. |
Input |
xr |
const int * |
End position in the x direction of the solving space. |
Input |
yl |
const int * |
Start position in the y direction of the solving space. |
Input |
yr |
const int * |
End position in the y direction of the solving space. |
Input |
zl |
const int * |
Start position in the z direction of the solving space. |
Input |
ybegin |
const int * |
Start position in the y direction of the auxiliary solving space. |
Input |
yend |
const int * |
End position in the y direction of the auxiliary solving space. |
Input |
zbegin |
const int * |
Start position in the z direction of the auxiliary solving space. |
Input |
zend |
const int * |
End position in the z direction of the auxiliary solving space. |
Input |
Return Values
Return Value |
Type |
Description |
|---|---|---|
KMLSS_NO_ERROR |
int |
The execution is successful. |
KMLSS_NULL_ARGUMENT |
int |
A null pointer exists in the input. |
KMLSS_BAD_DATA |
int |
The parameters related to the solving space are invalid. |
Dependency
#include "kml_gcr_specific.h"
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | int xl = 5; int yl = 5; int zl = 5; int xr = 6; int yr = 6; int zr = 6; int ybegin = 5; int yend = 6; int zbegin = 5; int zend = 6; float *a = (float*)malloc(sizeof(float) * 45); float *x = (float*)malloc(sizeof(float) * 3); float *b = (float*)malloc(sizeof(float) * 45); for (int i=0; i<45; i++) { a[i] = rand(); b[i] = rand(); } for (int i=0; i<3; i++) { x[i] = rand(); } KmlIssGcrSpmv(a, x, b, &xl, &xr, &yl, &yr, &zl, &ybegin, ¥d, &zbegin, &zend); |