Rate This Document
Findability
Accuracy
Completeness
Readability

KmlDssSolve

To perform back substitution on a matrix, you need to call KmlDssFactorize to factorize the matrix first.

Interface Definition

C interface:

int KmlDssSolve(KmlDssSolver *solver, const KmlSolverMatrix *b, KmlSolverMatrix *x, const KmlDssSolveOption *option);

Parameters

Parameter

Type

Description

Input/Output

solver

KmlDssSolver *

Solver handle created by KmlDssInit.

Input

b

KmlSolverMatrix *

Pointer to the RHS vector structure, which is essentially a matrix and is created by the KmlSolverMatrixCreate function. The pointer cannot be null.

Input

x

KmlSolverMatrix *

Pointer to the solution space structure, which is essentially a matrix and is created by the KmlSolverMatrixCreate function. The input cannot be a null pointer, and the output is a numerical array containing the solved x.

Output

option

KmlDssSolveOption *

Configuration in the factorization phase, which cannot be a null pointer. For details, see Table 1.

Input

Table 1 KmlDssSolveOption structure

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.

stage

KmlDssSolveStage

Back substitution phase. The options are as follows:

  • KMLDSS_SOLVE_ALL: full-phase back substitution, including iterative refinement. This is the default option.
  • KMLDSS_SOLVE_FORWARD: forward substitution only.
  • KMLDSS_SOLVE_DIAGONAL: diagonal block solving only.
  • KMLDSS_SOLVE_BACKWARD: backward substitution only.
  • KMLDSS_SOLVE_REFINE: iterative refinement only.

Mask bit: KMLDSS_SOLVE_OPTION_SOLVE_STAGE

refineMethod

KmlDssRefineMethod

Iterative refinement method, including:

  • KMLDSS_REFINE_OFF: iterative refinement disabled (default option)
  • KMLDSS_REFINE_CLASSICAL: classical iterative refinement

Mask bit: KMLDSS_SOLVE_OPTION_REFINE_METHOD

refineMaxSteps

int32_t

Maximum number of iterative refinement steps, including:

  • The value 0 indicates that the solver automatically determines the value. This is the default value.
  • A value greater than 0 indicates that the maximum number of iterative refinement steps is set by the user.

Mask bit: KMLDSS_SOLVE_OPTION_REFINE_MAX_STEP

refineTolerance

double

Residual threshold for iterative refinement, including the following values:

  • The value 0 indicates that the solver automatically determines the value. This is the default value.
  • A value greater than 0 indicates that the threshold is set by the user.

Mask bit: KMLDSS_SOLVE_OPTION_REFINE_TOLERANCE

If any of the following conditions is met, iteration refinement is terminated immediately:

  • The number of steps reaches refineMaxSteps.

    The calculation method of berr is .

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 {solver, b, x, option}.

Dependencies

#include "kml_dss.h"