KmlScadssSYMSolve?I
Solve LDLTx = b.
Interface Definition
C interfaces:
int KmlScadssSymSolveSI(KmlScaSolverTask **pHandle, int nb, float *x, int ldx, float *b, int ldb);
int KmlScadssSymSolveDI(KmlScaSolverTask **pHandle, int nb, double *x, int ldx, double *b, int ldb);
int KmlScadssSymSolveCI(KmlScaSolverTask **pHandle, int nb, kml_complex_float *x, int ldx, kml_complex_float *b, int ldb);
int KmlScadssSymSolveZI(KmlScaSolverTask **pHandle, int nb, kml_complex_double *x, int ldx, kml_complex_double *b, int ldb);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
pHandle |
KmlScasolverTask ** |
Solver handle, which is a variable passed from a previous step. |
Input/Output |
Return Value
Return Value |
Type |
Description |
|---|---|---|
KMLSS_NO_ERROR |
int |
The execution is successful. |
KMLSS_NULL_ARGUMENT |
int |
Invalid parameter. |
KMLSS_BAD_HANDLE |
int |
The format of pHandle is incorrect. |
Dependencies
#include "kml_scadss.h"
Examples
C interface:
MPI_Init(NULL, NULL);
int size, rank;
MPI_Comm_size(MPI_COMM_WORLD, &size);// Obtain the total number of processes.
MPI_Comm_rank(MPI_COMM_WORLD, &rank);// Obtain the current process rank.
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 = KmlScadssSymInitDI(&matrix_handle, n, a, ja, ia, MPI_COMM_WORLD);
ierr = KmlScadssSymAnalyzeDI(&matrix_handle);
ierr = KmlScadssSymFactorizeDI(&matrix_handle);
int nrhs = 1;
int ldx=n, ldb=n;
ierr = KmlScadssSymSolveDI(&matrix_handle, nrhs, x, ldx, b, ldb);
ierr = KmlScadssSymCleanDI(&matrix_handle);
if (ierr != 0) {
printf("\nERROR in KmlScadssSymCleanDI: %d", ierr);
}