---
title: KmlDssGenFactorize?I
description: "实现通用矩阵的LU分解。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengboostkithistory/240RC1/accel/kunpengaccel_kml_16_0488.html
sourcePath: /source/zh/kunpengboostkithistory/240RC1/accel/kunpengaccel_kml_16_0488.html
indexId: 56f4c06bc525c2bfd7eee10b2e36d069ace50e0d646b17c03029657a1328a0b176
---
# KmlDssGenFactorize?I

实现通用矩阵的LU分解。

#### 接口定义

C Interface：

int KmlDssGenFactorizeSI(KmlSolverTask **pHandle);

int KmlDssGenFactorizeDI(KmlSolverTask **pHandle);

int KmlDssGenFactorizeCI(KmlSolverTask **pHandle);

int KmlDssGenFactorizeZI(KmlSolverTask **pHandle);


#### 参数

| 参数名 | 类型 | 描述 | 输入/输出 |
| --- | --- | --- | --- |
| pHandle | KmlSolverTask \*\* | 求解器句柄，传入之前步骤的变量。 | 输入 |


#### 返回值

| 返回值 | 类型 | 描述 |
| --- | --- | --- |
| KMLSS\_NO\_ERROR | int | 正常执行。 |
| KMLSS\_NULL\_ARGUMENT | int | pHandle为空指针。 |
| KMLSS\_BAD\_HANDLE | int | 参数无效或格式存在问题。 |
| KMLSS\_INVALID\_CALL\_ORDER | int | 错误的调用顺序，之前未进入分解阶段。 |
| KMLSS\_NO\_MEMORY | int | 开辟内存失败。 |
| KMLSS\_INTERNAL\_ERROR | 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);
}
ierr = KmlDssGenAnalyzeDI(&handle);
if (ierr != 0) {
printf("\nERROR in KmlDssGenAnalyzeDI: %d", ierr);
}
ierr = KmlDssGenFactorizeDI(&handle);
if (ierr != 0) {
printf("\nERROR in KmlDssGenFactorizeDI: %d", ierr);
}
```
