我要评分
获取效率
正确性
完整性
易理解

Data Types

Basic Data Types

Integer:

typedef int KML_INT; 32-bit integer

#define MAX_KML_INT 0x7FFFFFFD            /* Reduce the maximum value of 32-bit KML_INT by 2, to avoid overflow of rows+2 during memory allocation */

Complex:

  • Single-precision complex:
    typedef struct { 
        float real; 
        float imag; 
    } KML_Complex8;
  • Double-precision complex:
    typedef struct { 
        double real; 
        double imag; 
    } KML_Complex16;

Enumeration Types

Table 1 describes the enumeration types of KML_SPBLAS.

Table 1 Enumeration types and syntax

Enumeration Type

Description

Syntax

kml_sparse_status_t

Function execution status

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

Operation on the matrix, for example, non-transpose, transpose, or conjugate transpose

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

Type of the sparse matrix

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

Storage format of the sparse matrix

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

Indicates whether the index of the sparse matrix starts from 0 or 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

Indicates whether the sparse matrix is an upper triangular matrix or a lower triangular matrix.

typedef enum{

KML_SPARSE_FILL_MODE_LOWER = 0,

KML_SPARSE_FILL_MODE_UPPER = 1

} kml_sparse_fill_mode_t;

kml_sparse_diag_type_t

Indicates whether the sparse matrix is a unit matrix.

typedef enum{

KML_SPARSE_DIAG_NON_UNIT = 0,

KML_SPARSE_DIAG_UNIT = 1

} kml_sparse_diag_type_t;

kml_sparse_layout_t

Indicates whether the sparse matrix is in row- or column-major order.

typedef enum{

KML_SPARSE_LAYOUT_ROW_MAJOR = 0,

KML_SPARSE_LAYOUT_COLUMN_MAJOR = 1

} kml_sparse_layout_t;

kml_sparse_order_t

Indicates whether the sparse matrix is sorted.

typedef enum{

KML_SPARSE_NON_ORDER = 0,

KML_SPARSE_ORDER = 1

} kml_sparse_order_t;

kml_sparse_datatype_t

Data type

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;