---
title: KmlIssGcrAxpyP
description: "计算GCR算法中的。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengboostkithistory/240RC2/accel/kunpengaccel_kml_16_0464.html
sourcePath: /source/zh/kunpengboostkithistory/240RC2/accel/kunpengaccel_kml_16_0464.html
indexId: 6a2e9e9a2c7911f549c32b1bccc90a2074cc87b60edcb7aac1c592d6395878ef76
---
# KmlIssGcrAxpyP

计算GCR算法中的。

#### 接口定义

C Interface：

int KmlIssGcrAxpyP(float *r, float *p, const double *b, const int *m, const int *mt, const int *xl, const int *xr, const int *yl, const int *yr, const int *zl, const int *zr, const int *ybegin, const int *yend, const int *zbegin, const int *zend);


#### 参数

| 参数名 | 类型 | 描述 | 输入/输出 |
| --- | --- | --- | --- |
| r | float \* | GCR算法残差向量r，按(z,x,y)方向存储。 | 输入/输出 |
| p | float \* | GCR算法中间变量p，按(z,x,y)方向存储。 | 输入/输出 |
| b | const double \* | GCR算法中间变量beta。 | 输入 |
| m | const int \* | GCR算法中间变量j。 | 输入 |
| mt | const int \* | GCR算法中间变量p存储位置，一般为j+1。 | 输入 |
| xl | const int \* | 求解空间x方向起始位置。 | 输入 |
| xr | const int \* | 求解空间x方向结束位置。 | 输入 |
| yl | const int \* | 求解空间y方向起始位置。 | 输入 |
| yr | const int \* | 求解空间y方向结束位置。 | 输入 |
| zl | const int \* | 求解空间z方向起始位置。 | 输入 |
| zr | const int \* | 求解空间z方向结束位置。 | 输入 |
| ybegin | const int \* | 辅助求解空间y方向起始位置。 | 输入 |
| yend | const int \* | 辅助求解空间y方向结束位置。 | 输入 |
| zbegin | const int \* | 辅助求解空间z方向起始位置。 | 输入 |
| zend | const int \* | 辅助求解空间z方向结束位置。 | 输入 |


#### 返回值

| 返回值 | 类型 | 描述 |
| --- | --- | --- |
| KMLSS\_NO\_ERROR | int | 正常执行。 |
| KMLSS\_NULL\_ARGUMENT | int | 输入中存在空指针。 |
| KMLSS\_BAD\_DATA | int | 求解空间相关参数为无效参数。 |


#### 依赖

#include "kml_gcr_specific.h"


#### 示例

C Interface：
```
int xl = 5;
int yl = 5;
int zl = 5;
int xr = 6;
int yr = 6;
int zr = 6;
int ybegin = yl;
int yend = yr;
int zbegin = zl;
int zend = zr;
int m = 1;
int mt = 2;
int n = 64;
float *r = (float*)malloc(sizeof(float) * 64);
float *p = (float*)malloc(sizeof(float) * 256);
double *b = (double*)malloc(sizeof(double) * 2);
for (int i=0; i<64; i++) {
r[i] = rand();
}
for (int i=0; i<256; i++) {
p[i] = rand();
}
for (int i=0; i<2; i++) {
b[i] = 1.0;
}
KmlIssGcrAxpyP(r, p, b, &m, &mt, &xl, &xr, &yl, &yr, &zl, &zr, &ybegin, &yend, &zbegin, &zend);
```
