---
title: KmlDssGenInit?I
description: "初始化数据结构，并将用户提供的系数矩阵关联到求解系统中，初始化LU方法时使用完整矩阵的CSR格式。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengboostkithistory/240RC2/accel/kunpengaccel_kml_16_0486.html
sourcePath: /source/zh/kunpengboostkithistory/240RC2/accel/kunpengaccel_kml_16_0486.html
indexId: 665cbf0be213450c7bdb30c19670a26e9d056e318ad8a51108dd917308920ecf76
---
# KmlDssGenInit?I

初始化数据结构，并将用户提供的系数矩阵关联到求解系统中，初始化LU方法时使用完整矩阵的CSR格式。

#### 接口定义

C Interface：

int KmlDssGenInitSI(KmlSolverTask **pHandle, int n, float *a, int *ja, int *ia)

int KmlDssGenInitDI(KmlSolverTask **pHandle, int n, double *a, int *ja, int *ia)

int KmlDssGenInitCI(KmlSolverTask **pHandle, int n, kml_complex_float *a, int *ja, int *ia)

int KmlDssGenInitZI(KmlSolverTask **pHandle, int n, kml_complex_double *a, int *ja, int *ia)


#### 参数

| 参数名 | 类型 | 描述 | 输入/输出 |
| --- | --- | --- | --- |
| pHandle | KmlSolverTask \*\* | 求解器句柄，pHandle不可为空指针。 | 输入/输出 |
| n | int | n为矩阵A的维度。 | 输入 |
| a | 在KmlDssSymInitSI中为float \*。 在KmlDssSymInitDI中为double \*。 在KmlDssSymInitCI中为kml\_complex\_float \*。 在KmlDssSymInitZI中为kml\_complex\_double \*。 | a是维度为非零元素个数的数组，a[i]为第i个非零元的值。该数组的生命周期与pHandle相同。 | 输入 |
| ja | int | ja是维度为非零元素个数的数组，ja[i]为第i个非零元的列号。该数组的生命周期与pHandle相同。 | 输入 |
| ia | int | ia为n+1维数组，ia[i]为第i行第一个非零元在所有非零元中的索引。该数组的生命周期与pHandle相同。 | 输入 |


#### 返回值

| 返回值 | 类型 | 描述 |
| --- | --- | --- |
| KMLSS\_NO\_ERROR | int | 正常执行。 |
| KMLSS\_NULL\_ARGUMENT | int | pHandle，a，ja，ia中有空指针。 |
| KMLSS\_BAD\_N | int | 矩阵维数输入值小于等于0。 |
| KMLSS\_NO\_MEMORY | int | 内存开辟失败。 |


#### 依赖

#include "kml_dss.h"或#include "kml_solver.h"


#### 示例

C Interface：
```
int n = 8;
int ia[9] = {0, 2, 4, 6, 7, 8, 10, 12, 14};
int ja[14] = {0, 7, 1, 6, 2, 5, 3, 4, 2, 5, 1, 6, 0, 7};
double a[14] = {1.0, 2.0, -2.0, 3.0, 3.0, 4.0, -4.0, 5.0, 4.0, -6.0, 3.0, 7.0, 2.0, 8.0};
KmlSolverTask *handle;
int ierr = KmlDssGenInitDI(&handle, n, a, ja, ia);
if (ierr != 0) {
printf("\nERROR in KmlDssGenInitDI: %d", ierr);
}
```
