|
|
@ -76,182 +76,119 @@ Availability:
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef LowerUnderscore
|
|
|
|
|
|
|
|
#define mld_cumf_fact_ mld_cumf_fact_
|
|
|
|
|
|
|
|
#define mld_cumf_solve_ mld_cumf_solve_
|
|
|
|
|
|
|
|
#define mld_cumf_free_ mld_cumf_free_
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef LowerDoubleUnderscore
|
|
|
|
|
|
|
|
#define mld_cumf_fact_ mld_cumf_fact__
|
|
|
|
|
|
|
|
#define mld_cumf_solve_ mld_cumf_solve__
|
|
|
|
|
|
|
|
#define mld_cumf_free_ mld_cumf_free__
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef LowerCase
|
|
|
|
|
|
|
|
#define mld_cumf_fact_ mld_cumf_fact
|
|
|
|
|
|
|
|
#define mld_cumf_solve_ mld_cumf_solve
|
|
|
|
|
|
|
|
#define mld_cumf_free_ mld_cumf_free
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef UpperUnderscore
|
|
|
|
|
|
|
|
#define mld_cumf_fact_ MLD_CUMF_FACT_
|
|
|
|
|
|
|
|
#define mld_cumf_solve_ MLD_CUMF_SOLVE_
|
|
|
|
|
|
|
|
#define mld_cumf_free_ MLD_CUMF_FREE_
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef UpperDoubleUnderscore
|
|
|
|
|
|
|
|
#define mld_cumf_fact_ MLD_CUMF_FACT__
|
|
|
|
|
|
|
|
#define mld_cumf_solve_ MLD_CUMF_SOLVE__
|
|
|
|
|
|
|
|
#define mld_cumf_free_ MLD_CUMF_FREE__
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef UpperCase
|
|
|
|
|
|
|
|
#define mld_cumf_fact_ MLD_CUMF_FACT
|
|
|
|
|
|
|
|
#define mld_cumf_solve_ MLD_CUMF_SOLVE
|
|
|
|
|
|
|
|
#define mld_cumf_free_ MLD_CUMF_FREE
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
/* No single complex in UMFPACK */
|
|
|
|
|
|
|
|
#ifdef Have_UMF_
|
|
|
|
|
|
|
|
#undef Have_UMF_
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef Have_UMF_
|
|
|
|
#ifdef Have_UMF_
|
|
|
|
#include "umfpack.h"
|
|
|
|
#include "umfpack.h"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef Ptr64Bits
|
|
|
|
|
|
|
|
typedef long long fptr;
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
typedef int fptr; /* 32-bit by default */
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
|
|
mld_cumf_fact_(int *n, int *nnz,
|
|
|
|
|
|
|
|
double *values, int *rowind, int *colptr,
|
|
|
|
|
|
|
|
#ifdef Have_UMF_
|
|
|
|
|
|
|
|
fptr *symptr,
|
|
|
|
|
|
|
|
fptr *numptr,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
int mld_cumf_fact(int n, int nnz,
|
|
|
|
void *symptr,
|
|
|
|
float *values, int *rowind, int *colptr,
|
|
|
|
void *numptr,
|
|
|
|
void **symptr, void **numptr,
|
|
|
|
#endif
|
|
|
|
long long int *ssize,
|
|
|
|
int *info)
|
|
|
|
long long int *nsize)
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef Have_UMF_
|
|
|
|
#ifdef Have_UMF_
|
|
|
|
double Info [UMFPACK_INFO], Control [UMFPACK_CONTROL];
|
|
|
|
double Info [UMFPACK_INFO], Control [UMFPACK_CONTROL];
|
|
|
|
void *Symbolic, *Numeric ;
|
|
|
|
void *Symbolic, *Numeric ;
|
|
|
|
int i;
|
|
|
|
int i, info;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
umfpack_zi_defaults(Control);
|
|
|
|
umfpack_si_defaults(Control);
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i <= *n; ++i) --colptr[i];
|
|
|
|
info = umfpack_ci_symbolic (n, n, colptr, rowind, values, NULL, &Symbolic,
|
|
|
|
for (i = 0; i < *nnz; ++i) --rowind[i];
|
|
|
|
|
|
|
|
*info = umfpack_zi_symbolic (*n, *n, colptr, rowind, values, NULL, &Symbolic,
|
|
|
|
|
|
|
|
Control, Info);
|
|
|
|
Control, Info);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( *info == UMFPACK_OK ) {
|
|
|
|
if ( info == UMFPACK_OK ) {
|
|
|
|
*info = 0;
|
|
|
|
info = 0;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
printf("umfpack_zi_symbolic() error returns INFO= %d\n", *info);
|
|
|
|
printf("umfpack_ci_symbolic() error returns INFO= %d\n", info);
|
|
|
|
*info = -11;
|
|
|
|
*symptr = (void *) NULL;
|
|
|
|
*numptr = (fptr) NULL;
|
|
|
|
*numptr = (void *) NULL;
|
|
|
|
return;
|
|
|
|
return -11;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
*symptr = (fptr) Symbolic;
|
|
|
|
*symptr = Symbolic;
|
|
|
|
|
|
|
|
*ssize = Info[UMFPACK_SYMBOLIC_SIZE];
|
|
|
|
|
|
|
|
*ssize *= Info[UMFPACK_SIZE_OF_UNIT];
|
|
|
|
|
|
|
|
|
|
|
|
*info = umfpack_zi_numeric (colptr, rowind, values, NULL, Symbolic, &Numeric,
|
|
|
|
info = umfpack_ci_numeric (colptr, rowind, values, NULL, Symbolic, &Numeric,
|
|
|
|
Control, Info) ;
|
|
|
|
Control, Info) ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( *info == UMFPACK_OK ) {
|
|
|
|
if ( info == UMFPACK_OK ) {
|
|
|
|
*info = 0;
|
|
|
|
info = 0;
|
|
|
|
*numptr = (fptr) Numeric;
|
|
|
|
*numptr = Numeric;
|
|
|
|
|
|
|
|
*nsize = Info[UMFPACK_NUMERIC_SIZE];
|
|
|
|
|
|
|
|
*nsize *= Info[UMFPACK_SIZE_OF_UNIT];
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
printf("umfpack_zi_numeric() error returns INFO= %d\n", *info);
|
|
|
|
printf("umfpack_ci_numeric() error returns INFO= %d\n", info);
|
|
|
|
*info = -12;
|
|
|
|
info = -12;
|
|
|
|
*numptr = (fptr) NULL;
|
|
|
|
*numptr = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i <= *n; ++i) ++colptr[i];
|
|
|
|
|
|
|
|
for (i = 0; i < *nnz; ++i) ++rowind[i];
|
|
|
|
return info;
|
|
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
fprintf(stderr," UMF Not available for single precision.\n");
|
|
|
|
fprintf(stderr," UMF Not available for single precision.\n");
|
|
|
|
*info=-1;
|
|
|
|
return -1;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
int mld_cumf_solve(int itrans, int n,
|
|
|
|
mld_cumf_solve_(int *itrans, int *n,
|
|
|
|
float *x, float *b, int ldb,
|
|
|
|
double *x, double *b, int *ldb,
|
|
|
|
void *numptr)
|
|
|
|
#ifdef Have_UMF_
|
|
|
|
|
|
|
|
fptr *numptr,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
void *numptr,
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int *info)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#ifdef Have_UMF_
|
|
|
|
#ifdef Have_UMF_
|
|
|
|
double Info [UMFPACK_INFO], Control [UMFPACK_CONTROL];
|
|
|
|
double Info [UMFPACK_INFO], Control [UMFPACK_CONTROL];
|
|
|
|
void *Symbolic, *Numeric ;
|
|
|
|
void *Symbolic, *Numeric ;
|
|
|
|
int i,trans;
|
|
|
|
int i,trans, info;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
umfpack_di_defaults(Control);
|
|
|
|
umfpack_si_defaults(Control);
|
|
|
|
Control[UMFPACK_IRSTEP]=0;
|
|
|
|
Control[UMFPACK_IRSTEP]=0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (*itrans == 0) {
|
|
|
|
if (itrans == 0) {
|
|
|
|
trans = UMFPACK_A;
|
|
|
|
trans = UMFPACK_A;
|
|
|
|
} else if (*itrans ==1) {
|
|
|
|
} else if (itrans ==1) {
|
|
|
|
trans = UMFPACK_At;
|
|
|
|
trans = UMFPACK_At;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
trans = UMFPACK_A;
|
|
|
|
trans = UMFPACK_A;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
*info = umfpack_zi_solve(trans,NULL,NULL,NULL,NULL,
|
|
|
|
info = umfpack_ci_solve(trans,NULL,NULL,NULL,NULL,
|
|
|
|
x,NULL,b,NULL,(void *) *numptr,Control,Info);
|
|
|
|
x,NULL,b,NULL, numptr,Control,Info);
|
|
|
|
|
|
|
|
return info;
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
fprintf(stderr," UMF Not available for single precision.\n");
|
|
|
|
fprintf(stderr," UMF Not available for single precision.\n");
|
|
|
|
*info=-1;
|
|
|
|
return -1;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
int mld_cumf_free(void *symptr, void *numptr)
|
|
|
|
mld_cumf_free_(
|
|
|
|
|
|
|
|
#ifdef Have_UMF_
|
|
|
|
|
|
|
|
fptr *symptr,
|
|
|
|
|
|
|
|
fptr *numptr,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
void *symptr,
|
|
|
|
|
|
|
|
void *numptr,
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int *info)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#ifdef Have_UMF_
|
|
|
|
#ifdef Have_UMF_
|
|
|
|
void *Symbolic, *Numeric ;
|
|
|
|
void *Symbolic, *Numeric ;
|
|
|
|
Symbolic = (void *) *symptr;
|
|
|
|
Symbolic = symptr;
|
|
|
|
Numeric = (void *) *numptr;
|
|
|
|
Numeric = numptr;
|
|
|
|
|
|
|
|
|
|
|
|
umfpack_zi_free_numeric(&Numeric);
|
|
|
|
umfpack_ci_free_numeric(&Numeric);
|
|
|
|
umfpack_zi_free_symbolic(&Symbolic);
|
|
|
|
umfpack_ci_free_symbolic(&Symbolic);
|
|
|
|
*info=0;
|
|
|
|
return 0;
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
fprintf(stderr," UMF Not available for single precision.\n");
|
|
|
|
fprintf(stderr," UMF Not available for single precision.\n");
|
|
|
|
*info=-1;
|
|
|
|
return -1;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|