KmlDssGenInit?I
Initialize the data structure and associate a provided coefficient matrix with the solution system. The complete matrix in CSR format is used when the LU method is initialized.
Interface Definition
C interface:
int KmlDssGenInitSI(KmlSolverTask **pHandle, int n, float *a, int *ja, int *ia)
int KmlDssGenInitDI(KmlSolverTask **pHandle, int n, double *a, int *ja, int *ia)
int KmlDssGenInitCI(KmlSolverTask **pHandle, int n, kml_complex_float *a, int *ja, int *ia)
int KmlDssGenInitZI(KmlSolverTask **pHandle, int n, kml_complex_double *a, int *ja, int *ia)
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
pHandle |
KmlSolverTask ** |
Solver handle. pHandle cannot be a null pointer. |
Input/Output |
n |
int |
Dimension of matrix A |
Input |
a |
|
Array whose dimension is the quantity of non-zero elements. a[i] is the value of the i-th non-zero element. The lifecycle of this array is the same as that of pHandle. |
Input |
ja |
int |
Array whose dimension is the quantity of non-zero elements. ja[i] is the column number of the i-th non-zero element. The lifecycle of this array is the same as that of pHandle. |
Input |
ia |
int |
(n+1)-dimensional array. ia[i] is the index of the first non-zero element in the i-th row in all non-zero elements. The lifecycle of this array is the same as that of pHandle. |
Input |
Return Value
Return Value |
Type |
Description |
|---|---|---|
KMLSS_NO_ERROR |
int |
The execution is successful. |
KMLSS_NULL_ARGUMENT |
int |
A null argument exists in {pHandle, a, ja, ia}. |
KMLSS_BAD_N |
int |
The input matrix dimension is less than or equal to 0. |
KMLSS_NO_MEMORY |
int |
Memory allocation failed. |
Dependencies
#include "kml_dss.h" or #include "kml_solver.h"
Examples
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};
KmlSolverTask *handle;
int ierr = KmlDssGenInitDI(&handle, n, a, ja, ia);
if (ierr != 0) {
printf("\nERROR in KmlDssGenInitDI: %d", ierr);
}