KmlDssGenSet?II
Set handle-related integer values.
Interface Definition
C interface:
int KmlDssGenSetSII(KmlSolverTask **pHandle, enum KmlSolverParam param, int *value, int nvalue);
int KmlDssGenSetDII(KmlSolverTask **pHandle, enum KmlSolverParam param, int *value, int nvalue);
int KmlDssGenSetCII(KmlSolverTask **pHandle, enum KmlSolverParam param, int *value, int nvalue);
int KmlDssGenSetZII(KmlSolverTask **pHandle, enum KmlSolverParam param, int *value, int nvalue);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
pHandle |
KmlSolverTask ** |
Solver handle. pHandle cannot be a null pointer. |
Input |
param |
enum KmlSolverParam |
|
Input |
value |
int* |
Array containing parameters related to direct resolution |
Input |
nvalue |
int |
Number of elements in the value array |
Input |
value varies with param. Especially, some elements in value can be constants. The following table lists the options.
Param Option |
Value |
Description |
|---|---|---|
KMLSS_PERM |
One-dimensional array. The array length is the same as the matrix dimension. |
Performs user-defined row/column reordering. |
KMLSS_REFINEMENT_MAX_STEPS |
Address of a positive integer array or positive integer whose length is 1 |
Sets the maximum number of iteration refinement times. |
KMLSS_BOOST_THRESHOLD |
Address of a positive integer array or positive integer whose length is 1 |
Controls the boost parameter in the solver. |
KMLSS_SCALING_TYPE |
KMLSS_NO_SCALING |
Performs no scaling operation. |
KMLSS_ROWCOLUMN_SCALING |
Performs row/column scaling. |
|
KMLSS_MATCHBASED_SCALING |
Performs scaling operations related to the Match algorithm. |
|
KMLSS_MATCHING_TYPE |
KMLSS_MATCHING_OFF |
Disables the Match algorithm. |
KMLSS_MATCHING_HUNGARIAN |
Hungarian algorithm |
|
KMLSS_REFINEMENT_TOLERANCE_LEVEL |
Address of a positive integer array or positive integer whose length is 1 |
Threshold set by the iterative refinement algorithm. The value is a negative power of 10. |
Return Value
Return Value |
Type |
Description |
|---|---|---|
KMLSS_NO_ERROR |
int |
The execution is successful. |
KMLSS_NULL_ARGUMENT |
int |
The handle or data pointer is null. |
KMLSS_BAD_HANDLE |
int |
The format of pHandle is incorrect. |
KMLSS_BAD_SELECTOR |
int |
The input value of KML_SOLVER_PARAM is not supported currently or does not exist during the analysis. |
KMLSS_BAD_DATA |
int |
The user-defined value does not meet the requirements. |
Dependencies
#include "kml_dss.h" or #include "kml_solver.h"
Examples
C interface:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | 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); } double tolerance = 1.e-12; ierr = KmlDssGenSetDID(&handle, KMLSS_REFINEMENT_TOLERANCE_LEVEL, &tolerance, 1); if (ierr != 0) { printf("\nERROR in KmlDssGenSetDID: %d", ierr); } int nsteps = 2; ierr = KmlDssGenSetDII(&handle, KMLSS_REFINEMENT_MAX_STEPS, &nsteps, 1); if (ierr != 0) { printf("\nERROR in KmlDssGenSetDII: %d", ierr); } ierr = KmlDssGenSolveDI(&handle, nrhs, x, ldx, b, ldb); if (ierr != 0) { printf("\nERROR in KmlDssGenSolveDI: %d", ierr); } for (int i = 0; i < n; i++) { printf("%lf ", x[i]); } printf("\n"); |
1 | 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 |