KmlSolverMatrixCreate
Create a matrix operation handle.
Shallow copy is used during matrix creation. You need to ensure that the memory specified by the store parameter is not freed before KmlSolverMatrixDestroy is called.
Interface Definition
C interface:
int KmlSolverMatrixCreate(KmlSolverMatrix **pMatrix, const KmlSolverMatrixStore *store, const KmlSolverMatrixOption *matOption);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
pMatrix |
KmlSolverMatrix ** |
Matrix handle. pMatrix cannot be a null pointer. |
Input/Output |
store |
KmlSolverMatrixStore * |
Matrix format structure, which cannot be a null pointer. For details, see Table 1. |
Input |
matOption |
KmlSolverMatrixOption * |
Matrix configuration option, which cannot be a null pointer. For details, see Table 2. |
Input |
Field |
Type |
Description |
|---|---|---|
valueType |
KmlSolverValueType |
Value type. The options are as follows:
|
indexType |
KmlSolverIndexType |
Matrix coordinate index type.
|
nRow |
int64_t |
Number of rows in a matrix |
nCol |
int64_t |
Number of columns in a matrix |
format |
KmlSolverMatrixStoreFormat |
Matrix storage format. The options are as follows:
|
csr |
KmlSolverMatrixStoreCSR Table 3 describes the fields of this type. |
This field is valid only when format is set to KMLSS_MATRIX_STORE_CSR, KMLSS_MATRIX_STORE_CSR_L, or KMLSS_MATRIX_STORE_CSR_U. |
csc |
KmlSolverMatrixStoreCSC Table 4 describes the fields of this type. |
This field is valid only when format is set to KMLSS_MATRIX_STORE_CSC, KMLSS_MATRIX_STORE_CSC_L, or KMLSS_MATRIX_STORE_CSC_U. |
coo |
KmlSolverMatrixStoreCOO Table 5 describes the fields of this type. |
This field is valid only when format is set to KMLSS_MATRIX_STORE_COO, KMLSS_MATRIX_STORE_COO_L, or KMLSS_MATRIX_STORE_COO_U. |
dense |
KmlSolverMatrixStoreDense Table 6 describes the fields of this type. |
This field is valid only when format is set to KMLSS_MATRIX_STORE_DENSE_ROW_MAJOR or KMLSS_MATRIX_STORE_DENSE_COL_MAJOR. |
Field |
Type |
Description |
|---|---|---|
fieldMask |
uint64_t |
Mask that determines to which fields the configuration is applied. If a bit is set to 1, its corresponding field uses a specified value. If a bit is set to 0, its corresponding field uses the default value. See the individual field description for configurable mask bits. |
type |
KmlSolverMatrixType |
Matrix type. The options are as follows:
Mask bit: KMLSS_MATRIX_OPTION_TYPE |
Field |
Type |
Description |
|---|---|---|
value |
void * |
Non-zero element value array. The size is the number of non-zero elements. |
rowOffset |
void * |
Row offset array. The size is the number of rows plus 1. |
colIndex |
void * |
Column coordinate array. The size is the number of non-zero elements. The values must be sorted in ascending order. |
Field |
Type |
Description |
|---|---|---|
value |
void * |
Non-zero element value array. The size is the number of non-zero elements. |
rowIndex |
void * |
Row coordinate array. The size is the number of non-zero elements. The values must be sorted in ascending order. |
colOffset |
void * |
Column offset array. The size is the number of rows plus 1. |
Field |
Type |
Description |
|---|---|---|
value |
void * |
Non-zero element value array. The size is the number of non-zero elements. |
rowId |
void * |
Row coordinate array. The size is the number of non-zero elements. The values must be sorted in ascending order. |
colId |
void * |
Column coordinate array. The size is the number of non-zero elements. The column IDs in the same row must be sorted in ascending order. |
nnz |
int64_t |
Number of non-zero elements. |
Field |
Type |
Description |
|---|---|---|
value |
void * |
Matrix value array. The size is the number of rows multiplied by the number of columns. |
ld |
int64_t |
Leading dimension. For a row-major order, ld represents the array length required to store each row; for a column-major order, ld represents the array length required to store each column. |
Return Value
Return Value |
Type |
Description |
|---|---|---|
KMLSS_NO_ERROR |
int |
Normal execution. |
KMLSS_INTERNAL_ERROR |
int |
Internal error. |
KMLSS_NULL_ARGUMENT |
int |
A null argument exists in {pMatrix, store, matOption}. |
Dependencies
#include "kml_solver.h"