---
title: KesMatrixCreate
description: "KesReturnCode KesMatrixCreate(KesMatrix *A, KesScalarType type, KesMatrixFormat format);"
url: https://www.hikunpeng.com/document/detail/zh/kunpengboostkithistory/240RC1/accel/kunpengaccel_kml_16_0730.html
sourcePath: /source/zh/kunpengboostkithistory/240RC1/accel/kunpengaccel_kml_16_0730.html
indexId: 8d85f3849c9c4e2cfedf4f7ebd8507ce4fa31bae6ec9aefc0cd2ff4c9de9016076
---
# KesMatrixCreate

#### 接口定义

KesReturnCode KesMatrixCreate(KesMatrix *A, KesScalarType type, KesMatrixFormat format);


#### 接口说明

创建矩阵，并指定数据类型、矩阵形式。


#### 参数

| 参数名 | 类型 | 描述 | 输入/输出 |
| --- | --- | --- | --- |
| A | KesMatrix \* | 矩阵句柄，不能为空指针。 | 输入/输出 |
| type | KesScalarType | 数据类型。 | 输入 |
| format | KesMatrixFormat | 矩阵类型。 | 输入 |


| KesMatrixFormat | 类型描述 |
| --- | --- |
| KES\_EMPTY\_MATRIX | 空矩阵。 |
| KES\_SHELL | 用户自定义的矩阵向量乘格式，矩阵的数据以及相应的MatVec通过相关接口指定。 |


| KesScalarType | 类型描述 | 对应C的类型 |
| --- | --- | --- |
| KES\_SCALAR\_FP32 | 单精度实数浮点类型。 | float |
| KES\_SCALAR\_FP32C | 单精度复数浮点类型。 | float \_Complex |
| KES\_SCALAR\_FP64 | 双精度实数浮点类型。 | double |
| KES\_SCALAR\_FP64C | 双精度复数浮点类型。 | double \_Complex |
