Rate This Document
Findability
Accuracy
Completeness
Readability

KmlScadss(SPD/HPD)Init?I

Initialize the data structure and associate a provided coefficient matrix with the solution system. The upper triangular part of the matrix in CSR format is used when the LLT or LLH method for clusters is initialized.

Interface Definition

C interface:

int KmlScadssSpdInitSI(KmlScasolverTask **pHandle, int n, float *a, int *ja, int *ia, MPI_Comm comm);

int KmlScadssSpdInitDI(KmlScasolverTask **pHandle, int n, double *a, int *ja, int *ia, MPI_Comm comm);

int KmlScadssHpdInitCI(KmlScasolverTask **pHandle, int n, kml_complex_float *a, int *ja, int *ia, MPI_Comm comm);

int KmlScadssHpdInitZI(KmlScasolverTask **pHandle, int n, kml_complex_double *a, int *ja, int *ia, MPI_Comm comm);

Parameters

Parameter

Type

Description

Input/Output

pHandle

KmlScasolverTask **

Solver handle. pHandle cannot be a null pointer.

Input/Output

n

int

Dimension of matrix A

Input

a

  • float * in KmlScadssSpdInitSI
  • double * in KmlScadssSpdInitDI
  • kml_complex_float * in KmlScadssHpdInitCI
  • kml_complex_double * in KmlScadssHpdInitZI

Array whose dimension is the quantity of non-zero elements. a[i] is the value of the ith 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 ith 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 ith row in all non-zero elements. The lifecycle of this array is the same as that of pHandle.

Input

comm

MPI_Comm

Communicator of the MPI process

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_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 ID.

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};
KmlScasolverTask* matrix_handle = NULL;
int ierr = KmlScadssSpdInitDI(&matrix_handle, n, a, ja, ia, MPI_COMM_WORLD);
if (ierr != 0) {
    printf("\nERROR in KmlScadssSpdInitDI: %d", ierr);
}