KmlScadss(SPD/HPD)Get?I
获取与handle关联的整型值。
接口定义
C Interface:
int KmlScadssSpdGetSI(KmlScaSolverTask **pHandle, enum KML_SOLVER_PARAM param, int64_t *value, int nvalue);
int KmlScadssSpdGetDI(KmlScaSolverTask **pHandle, enum KML_SOLVER_PARAM param, int64_t *value, int nvalue);
int KmlScadssHpdGetCI(KmlScaSolverTask **pHandle, enum KML_SOLVER_PARAM param, int64_t *value, int nvalue);
int KmlScadssHpdGetZI(KmlScaSolverTask **pHandle, enum KML_SOLVER_PARAM param, int64_t *value, int nvalue);
参数
参数名 |
类型 |
描述 |
输入/输出 |
---|---|---|---|
pHandle |
KmlScaSolverTask |
求解器句柄,pHandle不可为空指针。 |
输入 |
param |
enum KML_SOLVER_PARAM |
|
输入 |
value |
int64_t |
直接求解相关参数数组。 |
输出 |
nvalue |
int |
value数组元素个数。 |
输入 |
返回值
返回值 |
类型 |
描述 |
---|---|---|
KMLSS_NO_ERROR |
int |
正常执行。 |
KMLSS_NULL_ARGUMENT |
int |
pHandle为空指针。 |
KMLSS_BAD_HANDLE |
int |
pHandle内部格式转换错误。 |
KMLSS_BAD_DATA_SIZE |
int |
KMLSS_FILL_IN数组长度nvalue设置错误。 |
KMLSS_INTERNAL_ERROR |
int |
内部数据返回空指针,KMLSS_FILL_IN获取失败。 |
KMLSS_BAD_SELECTOR |
int |
用户的KML_SOLVER_PARAM输入当前不支持,或在求解过程中不存在。 |
依赖
#include "kml_scadss.h"
示例
C Interface:
MPI_Init(NULL, NULL); int size, rank; MPI_Comm_size(MPI_COMM_WORLD, &size);//获取总进程数 MPI_Comm_rank(MPI_COMM_WORLD, &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 = KmlScadssSpdInitDI(&matrix_handle, n, a, ja, ia, MPI_COMM_WORLD); ierr = KmlScadssSpdAnalyzeDI(&matrix_handle); ierr = KmlScadssSpdFactorizeDI(&matrix_handle); int nrhs = 1; int ldx=n, ldb=n; ierr = KmlScadssSpdSolveDI(&matrix_handle, nrhs, x, ldx, b, ldb); if (rank == 0) { int64_t nnz; ierr = KmlScadssSpdGetDI(&matrix_handle, KMLSS_FILL_IN, &nnz, 1); printf("NNZ = %ld\n", nnz); }
NNZ = 40