KmlDssGenGet?IL
Obtain handle-related long integer values.
Interface Definition
C interface:
int KmlDssGenGetSIL(KmlSolverTask **pHandle, enum KmlSolverParam param, int64_t *value, int nvalue);
int KmlDssGenGetDIL(KmlSolverTask **pHandle, enum KmlSolverParam param, int64_t *value, int nvalue);
int KmlDssGenGetCIL(KmlSolverTask **pHandle, enum KmlSolverParam param, int64_t *value, int nvalue);
int KmlDssGenGetZIL(KmlSolverTask **pHandle, enum KmlSolverParam param, int64_t *value, int nvalue);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
pHandle |
KmlSolverTask ** |
Solver handle. pHandle cannot be a null pointer. |
Input |
param |
enum KmlSolverParam |
KMLSS_FILL_IN indicates the number of parameters to be filled in. |
Input |
value |
int64_t |
Array containing parameters related to direct resolution |
Output |
nvalue |
int |
Number of elements in the value array. Currently, the number must be 1. |
Input |
Return Value
Return Value |
Type |
Description |
|---|---|---|
KMLSS_NO_ERROR |
int |
The execution is successful. |
KMLSS_NULL_ARGUMENT |
int |
The pHandle or data pointer is null. |
KMLSS_BAD_HANDLE |
int |
The format of pHandle is incorrect. |
KMLSS_BAD_DATA_SIZE |
int |
The user-defined length (nvalue) of the value array is improper. |
KMLSS_INTERNAL_ERROR |
int |
Failed to obtain KMLSS_FILL_IN because the pHandle status is abnormal. |
KMLSS_BAD_SELECTOR |
int |
The input value of KML_SOLVER_PARAM is not supported currently or does not exist during the analysis. |
Dependencies
#include "kml_dss.h" or #include "kml_solver.h"
Examples
C interface:
int n = 8;
int ia[9] = {0, 3, 7, 9, 11, 13, 15, 16, 17};
int ja[17] = {0, 3, 4, 1, 2, 3, 5, 2, 7, 3, 6, 4, 5, 5, 7, 6, 7};
double a[17] = {1.0, 1.0, 2.0, 9.0, 2.0, 1.0, -3.0, 3.0, 2.0, 9.0, -5.0, 6.0, 1.0, 4.0, 1.0, 7.0, 2.0};
double b[8] = {4.0, 9.0, 7.0, 6.0, 9.0, 3.0, 2.0, 5.0};
double x[8];
KmlScasolverTask* matrix_handle = NULL;
int ierr = KmlScadssSpdInitDI(&matrix_handle, n, a, ja, ia, MPI_COMM_WORLD);
ierr = KmlScadssSpdAnalyzeDI(&matrix_handle);
int nrhs = 1;
int ldx=n, ldb=n;
ierr = KmlScadssSpdSolveDI(&matrix_handle, nrhs, x, ldx, b, ldb);
if (rank == 0) {
int64_t nnz;
ierr = KmlScadssSpdGetDI(&matrix_handle, KMLSS_FILL_IN, &nnz, 1);
printf("NNZ = %ld\n", nnz);
}
int n = 8;
int ia[9] = {0, 2, 4, 6, 7, 8, 10, 12, 14};
int ja[14] = {0, 7, 1, 6, 2, 5, 3, 4, 2, 5, 1, 6, 0, 7};
double a[14] = {1.0, 2.0, -2.0, 3.0, 3.0, 4.0, -4.0, 5.0, 4.0, -6.0, 3.0, 7.0, 2.0, 8.0};
double b[8] = {3.0, 1.0, 7.0, -4.0, 5.0, -2.0, 10.0, 10.0};
double x[8];
int nrhs = 1;
int ldx = n, ldb = n;
KmlSolverTask *handle;
int ierr = KmlDssGenInitDI(&handle, n, a, ja, ia);
if (ierr != 0) {
printf("\nERROR in KmlDssGenInitDI: %d", ierr);
}
ierr = KmlDssGenAnalyzeDI(&handle);
if (ierr != 0) {
printf("\nERROR in KmlDssGenAnalyzeDI: %d", ierr);
}
ierr = KmlDssGenFactorizeDI(&handle);
if (ierr != 0) {
printf("\nERROR in KmlDssGenFactorizeDI: %d", ierr);
}
ierr = KmlDssGenSolveDI(&handle, nrhs, x, ldx, b, ldb);
if (ierr != 0) {
printf("\nERROR in KmlDssGenSolveDI: %d", ierr);
}
int64_t nnz;
ierr = KmlDssGenGetDIL(&handle, KMLSS_FILL_IN, &nnz, 1);
if (ierr != 0) {
printf("\nERROR in KmlDssGenGetDIL: %d", ierr);
}
printf("NNZ = %ld\n", nnz);
NNZ = 32