KmlDss(Spd/Hpd)Set?Il
Set a value associated with a handle.
C interfaces:
int KmlDssSpdSetSII(KmlSolverTask **pHandle, enum KmlSolverParam param, int *value, int nvalue);
int KmlDssSpdSetDII(KmlSolverTask **pHandle, enum KmlSolverParam param, int *value, int nvalue);
int KmlDssHpdSetCII(KmlSolverTask **pHandle, enum KmlSolverParam param, int *value, int nvalue);
int KmlDssHpdSetZII(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 solution methods. |
Input |
nvalue |
int |
Number of elements in the value array. |
Input |
value varies with param. Especially, some constants can be used. The following table lists the options.
Param Option |
Value |
Function |
|---|---|---|
KMLSS_PERM |
One-dimensional array. The array length is the same as the matrix dimension. |
User-defined row/column reordering |
KMLSS_REFINEMENT_MAX_STEPS |
A positive integer array whose length is 1 or the address of a positive integer |
Maximum number of iteration refinements |
KMLSS_BOOST_THRESHOLD |
A positive integer array whose length is 1 or the address of a positive integer |
Controls the boost parameter in the solver. |
KMLSS_SCALING_TYPE |
KMLSS_NO_SCALING |
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 |
A positive integer array whose length is 1 or the address of a positive integer |
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 solving process. |
KMLSS_BAD_DATA |
int |
The user-defined value does not meet the requirements. |
Dependencies
#include "kml_dss.h" or #include "kml_solver.h"
Examples
int n = 2;
int ia[3] = {0,2,4};
int ja[4] = {0,1,0,1};
double a[4] = {2,1,1,2};
double b[2] = {3,1};
double x[2];
int nrhs = 1;
int ldx = n, ldb = n;
KmlSolverTask *handle;
int ierr = KmlDssSpdInitDI(&handle, n, a, ja, ia);
if (ierr != 0) {
printf("\nERROR in KmlDssSpdInitDI: %d", ierr);
}
ierr = KmlDssSpdAnalyzeDI(&handle);
if (ierr != 0) {
printf("\nERROR in KmlDssSpdAnalyzeDI: %d", ierr);
}
ierr = KmlDssSpdFactorizeDI(&handle);
if (ierr != 0) {
printf("\nERROR in KmlDssSpdFactorizeDI: %d", ierr);
}
double tolerance = 1.e-12;
ierr = KmlDssSpdSetDID(&handle, KMLSS_REFINEMENT_TOLERANCE_LEVEL, &tolerance, 1);
if (ierr != 0) {
printf("\nERROR in KmlDssSpdSetDID: %d", ierr);
}
int nsteps = 2;
ierr = KmlDssSpdSetDII(&handle, KMLSS_REFINEMENT_MAX_STEPS, &nsteps, 1);
if (ierr != 0) {
printf("\nERROR in KmlDssSpdSetDII: %d", ierr);
}
ierr = KmlDssSpdSolveDI(&handle, nrhs, x, ldx, b, ldb);
if (ierr != 0) {
printf("\nERROR in KmlDssSpdSolveDI: %d", ierr);
}
int nstep;
ierr = KmlDssSpdGetDII(&handle, KMLSS_REFINEMENT_STEPS, &nstep, 1);
printf("REFINEMENT_STEP = %d\n", nstep);
REFINEMENT_STEP = 1