Rate This Document
Findability
Accuracy
Completeness
Readability

KmlDssSymSet?I(D/S)

Set handle-related real-number values.

Interface Definition

C interface:

int KmlDssSymSetSIS(KmlSolverTask **pHandle, enum KmlSolverParam param, float *value, int nvalue);

int KmlDssSymSetDID(KmlSolverTask **pHandle, enum KmlSolverParam param, double *value, int nvalue);

int KmlDssSymSetCIS(KmlSolverTask **pHandle, enum KmlSolverParam param, float *value, int nvalue);

int KmlDssSymSetZID(KmlSolverTask **pHandle, enum KmlSolverParam param, double *value, int nvalue);

Parameters

Parameter

Type

Description

Input/Output

pHandle

KmlSolverTask **

Solver handle. pHandle cannot be a null pointer.

Input

param

enum KmlSolverParam

  • KMLSS_REFINEMENT_TOLERANCE_LEVEL indicates the threshold set for the iterative refinement algorithm.
  • KMLSS_PIVOTING_THRESHOLD indicates the threshold set by the iterative pivoting algorithm. Its value is the value set by the pivoting algorithm.

Input

value

double or float

Array containing parameters related to direct resolution.

Input

nvalue

int

Number of elements in the value array.

Input

Return Values

Return Value

Type

Description

KMLSS_NO_ERROR

int

The execution is successful.

KMLSS_BAD_SELECTOR

int

The input value of KML_SOLVER_PARAM is not supported currently or does not exist during the analysis.

Dependency

#include "kml_dss.h" or #include "kml_solver.h"

Example

C interface:

int n = 8;
int ia[9] = {0, 2, 4, 6, 7, 8, 9, 10, 11};
int ja[11] = {0, 7, 1, 6, 2, 5, 3, 4, 5, 6, 7};
double a[11] = {1.0, 2.0, -2.0, 3.0, 3.0, 4.0, -4.0, 5.0, -6.0, 7.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 = KmlDssSymInitDI(&handle, n, a, ja, ia);
if (ierr != 0) {
        printf("\nERROR in KmlDssSymInitDI: %d", ierr);
}
ierr = KmlDssSymAnalyzeDI(&handle);
if (ierr != 0) {
        printf("\nERROR in KmlDssSymAnalyzeDI: %d", ierr);
}
ierr = KmlDssSymFactorizeDI(&handle);
if (ierr != 0) {
        printf("\nERROR in KmlDssSymFactorizeDI: %d", ierr);
}

double tolerance = 1.e-12;
ierr = KmlDssSymSetDID(&handle, KMLSS_REFINEMENT_TOLERANCE_LEVEL, &tolerance, 1);
if (ierr != 0) {
        printf("\nERROR in KmlDssSymSetDID: %d", ierr);
}
int nsteps = 2;
ierr = KmlDssSymSetDII(&handle, KMLSS_REFINEMENT_MAX_STEPS, &nsteps, 1);
if (ierr != 0) {
        printf("\nERROR in KmlDssSymSetDII: %d", ierr);
}

ierr = KmlDssSymSolveDI(&handle, nrhs, x, ldx, b, ldb);
if (ierr != 0) {
        printf("\nERROR in KmlDssSymSolveDI: %d", ierr);
}

int nstep;
ierr = KmlDssSymGetDII(&handle, KMLSS_REFINEMENT_STEPS, &nstep, 1);
printf("REFINEMENT_STEP = %d\n", nstep);
double res;
ierr = KmlDssSymGetDID(&handle, KMLSS_REFINEMENT_RESIDUAL, &res, 1);
printf("REFINEMENT_RESIDUAL = %f\n", res);
Output:
REFINEMENT_STEP = 1
REFINEMENT_RESIDUAL = 0.000000