数据类型
提供KML_SPBLAS库函数的数据类型说明。
基本数据类型
整型数据:
typedef int KML_INT; /*32位整型数*/ #define MAX_KML_INT 0x7FFFFFFD /* 32位KML_INT的最大值减2,避免rows+2申请内存时溢出 */
复数数据类型:
单精度复数
typedef struct { float real; float imag; } KML_Complex8;
双精度复数
typedef struct { double real; double imag; } KML_Complex16;
枚举类型
表1描述了KML_SPBLAS的枚举类型。
枚举类型 |
说明 |
定义 |
---|---|---|
kml_sparse_status_t |
表示函数执行状态。 |
typedef enum{ KML_SPARSE_STATUS_SUCCESS = 0, /* the operation was successful */ KML_SPARSE_STATUS_NOT_INITIALIZED = 1, /* empty handle or matrix arrays */ KML_SPARSE_STATUS_ALLOC_FAILED = 2, /* internal error: memory allocation failed */ KML_SPARSE_STATUS_INVALID_VALUE = 3, /* invalid input value */ KML_SPARSE_STATUS_EXECUTION_FAILED = 4, /* e.g. 0-diagonal element for triangular solver, etc. */ KML_SPARSE_STATUS_INTERNAL_ERROR = 5, /* internal error */ KML_SPARSE_STATUS_NOT_SUPPORTED = 6 /* e.g. operation for double precision doesn't support other types */ } kml_sparse_status_t; |
kml_sparse_operation_t |
表示矩阵的操作(无变化、转置、共轭转置)。 |
typedef enum { KML_SPARSE_OPERATION_NON_TRANSPOSE = 0, KML_SPARSE_OPERATION_TRANSPOSE = 1, KML_SPARSE_OPERATION_CONJUGATE_TRANSPOSE = 2, KML_SPARSE_OPERATION_NUM } kml_sparse_operation_t; |
kml_sparse_matrix_type_t |
表示稀疏矩阵的类型。 |
typedef enum{ KML_SPARSE_MATRIX_TYPE_GENERAL = 0, KML_SPARSE_MATRIX_TYPE_SYMMETRIC = 1, KML_SPARSE_MATRIX_TYPE_HERMITIAN = 2, KML_SPARSE_MATRIX_TYPE_TRIANGULAR = 3, KML_SPARSE_MATRIX_TYPE_DIAGONAL = 4, KML_SPARSE_MATRIX_TYPE_BLOCK_TRIANGULAR = 5, KML_SPARSE_MATRIX_TYPE_BLOCK_DIAGONAL = 6, KML_SPARSE_MATRIX_TYPE_NUM } kml_sparse_matrix_type_t; |
kml_sparse_format_t |
表示稀疏矩阵的存储格式。 |
typedef enum{ KML_SPARSE_FORMAT_COO = 0, KML_SPARSE_FORMAT_CSR = 1, KML_SPARSE_FORMAT_CSC = 2, KML_SPARSE_FORMAT_BSR = 3 KML_SPARSE_FORMAT_SKY = 4 KML_SPARSE_FORMAT_DIA = 5 } kml_sparse_format_t; |
kml_sparse_index_num_t |
表示稀疏矩阵的indx从0开始或1开始。 |
typedef enum{ KML_SPARSE_INDEX_BASE_ZERO = 0, KML_SPARSE_INDEX_BASE_ONE = 1 } kml_sparse_index_num_t; |
kml_sparse_fill_mode_t |
表示稀疏矩阵是上三角或下三角矩阵。 |
typedef enum{ KML_SPARSE_FILL_MODE_LOWER = 0, KML_SPARSE_FILL_MODE_UPPER = 1 } kml_sparse_fill_mode_t; |
kml_sparse_diag_type_t |
表示稀疏矩阵是否单元矩阵。 |
typedef enum{ KML_SPARSE_DIAG_NON_UNIT = 0, KML_SPARSE_DIAG_UNIT = 1 } kml_sparse_diag_type_t; |
kml_sparse_layout_t |
表示稀疏矩阵是行主序或列主序。 |
typedef enum{ KML_SPARSE_LAYOUT_ROW_MAJOR = 0, KML_SPARSE_LAYOUT_COLUMN_MAJOR = 1 } kml_sparse_layout_t; |
kml_sparse_order_t |
表示稀疏矩阵是否排序。 |
typedef enum{ KML_SPARSE_NON_ORDER = 0, KML_SPARSE_ORDER = 1 } kml_sparse_order_t; |
kml_sparse_datatype_t |
表示数据类型。 |
typedef enum{ KML_SPARSE_DATATYPE_FLOAT = 0, KML_SPARSE_DATATYPE_DOUBLE = 1, KML_SPARSE_DATATYPE_FLOAT_COMPLEX = 2, KML_SPARSE_DATATYPE_DOUBLE_COMPLEX = 3 } kml_sparse_datatype_t; |