---
title: KesMatrixCreate
description: "KesReturnCode KesMatrixCreate(KesMatrix *A, KesScalarType type, KesMatrixFormat format);"
url: https://www.hikunpeng.com/document/detail/zh/hpchistory/hpckit/develop2400/kunpengaccel_kml_0945.html
sourcePath: /source/zh/hpchistory/hpckit/develop2400/kunpengaccel_kml_0945.html
indexId: 41a65ec494176e64f0b8b434451de2d22f67cdf17ee5a05e20211155d0bd5d9867
---
# 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 |
