---
title: KmlIssPcStructilu0Setup
description: "分析并分解矩阵，计算ilu0预条件；创建并返回求解器句柄。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengboostkithistory/240RC2/accel/kunpengaccel_kml_16_0471.html
sourcePath: /source/zh/kunpengboostkithistory/240RC2/accel/kunpengaccel_kml_16_0471.html
indexId: 157f9e819e0a13da0d7ed66eae4c570e09d06d8e8f4d046293b34451da41066676
---
# KmlIssPcStructilu0Setup

分析并分解矩阵，计算ilu0预条件；创建并返回求解器句柄。

#### 接口定义

C Interface：

int KmlIssPcStructilu0Setup(KmlIssPsStructilu0Handle *gSmoother, float *v, const int *xl, const int *xr, const int *yl, const int *yr, const int *zl, const int *zr);


#### 参数

| 参数名 | 类型 | 描述 | 输入/输出 |
| --- | --- | --- | --- |
| gSmoother | KmlIssPsStructilu0Handle \* | 求解器句柄。 | 输出 |
| v | float \* | 待求解的19对角矩阵v，使用(l,k,i,j)格式数组存储；其中，l=1:19为对角线元素，k，i，j为空间位置。 | 输入 |
| xl | const int \* | 求解空间x方向起始位置。 | 输入 |
| xr | const int \* | 求解空间x方向结束位置。 | 输入 |
| yl | const int \* | 求解空间y方向起始位置。 | 输入 |
| yr | const int \* | 求解空间y方向结束位置。 | 输入 |
| zl | const int \* | 求解空间z方向起始位置。 | 输入 |
| zr | const int \* | 求解空间z方向结束位置。 | 输入 |


#### 返回值

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


#### 依赖

#include "kml_struct_ilu.h"


#### 示例

C Interface：
```
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 *v = (float*)malloc(sizeof(float) * 171);
float *b = (float*)malloc(sizeof(float) * 9);
for (int i=0; i<171; i++) {
v[i] = rand();
}
for (int i=0; i<9; i++) {
b[i] = rand();
}
KmlIssPsStructilu0Handle gSmoother;
KmlIssPcStructilu0Setup(&gSmoother, v, &xl, &xr, &yl, &yr, &zl, &zr);
```
