---
title: KmlDss(Spd/Hpd)Factorize?I
description: "实现对称正定矩阵的LLT分解或者Hermitian正定矩阵的LLH分解。"
url: https://www.hikunpeng.com/document/detail/zh/kunpenghpcs/hpckit/devg/kunpengaccel_kml_0883.html
sourcePath: /source/zh/kunpenghpcs/hpckit/devg/kunpengaccel_kml_0883.html
indexId: 41437471daf1f9cbb261c0359cbcf678f1aae7809a13eb98cba6dc985bb7ed5f61
---
# KmlDss(Spd/Hpd)Factorize?I

实现对称正定矩阵的LLT分解或者Hermitian正定矩阵的LLH分解。

#### 接口定义

C Interface：

int KmlDssSpdFactorizeSI(KmlSolverTask **pHandle);

int KmlDssSpdFactorizeDI(KmlSolverTask **pHandle);

int KmlDssHpdFactorizeCI(KmlSolverTask **pHandle);

int KmlDssHpdFactorizeZI(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 = 2;
int ia[3] = {0,2,4};
int ja[4] = {0,1,0,1};
double a[4] = {2,1,1,2};
double x[2];
KmlSolverTask *handle;
int ierr = KmlDssSpdInitDI(&handle, n, a, ja, ia);
if (ierr != 0) {
printf("\nERROR in KmlDssSpdInitDI: %d", ierr);
}
ierr = KmlDssSpdAnalyzeDI(&handle);
if (ierr != 0) {
printf("\nERROR in KmlDssSpdAnalyzeDI: %d", ierr);
}
ierr = KmlDssSpdFactorizeDI(&handle);
if (ierr != 0) {
printf("\nERROR in KmlDssSpdFactorizeDI: %d", ierr);
}
for (int i = 0; i < n; i++) {
printf("%lf ", x[i]);
}
```
