mld2p4-2:

mlprec/impl/mld_cumf_interface.c
 mlprec/impl/mld_dumf_interface.c
 mlprec/impl/mld_sumf_interface.c
 mlprec/impl/mld_zumf_interface.c

cleanup C layer.
stopcriterion
Salvatore Filippone 12 years ago
parent cdfa7497d8
commit 6df096e418

@ -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
} }

@ -81,12 +81,6 @@ Availability:
#include "umfpack.h" #include "umfpack.h"
#endif #endif
#ifdef Ptr64Bits
typedef long long fptr;
#else
typedef int fptr; /* 32-bit by default */
#endif
int mld_dumf_fact(int n, int nnz, int mld_dumf_fact(int n, int nnz,
double *values, int *rowind, int *colptr, double *values, int *rowind, int *colptr,
void **symptr, void **numptr, void **symptr, void **numptr,

@ -76,39 +76,6 @@ Availability:
*/ */
#ifdef LowerUndescore
#define mld_sumf_fact_ mld_sumf_fact_
#define mld_sumf_solve_ mld_sumf_solve_
#define mld_sumf_free_ mld_sumf_free_
#endif
#ifdef LowerDoubleUndescore
#define mld_sumf_fact_ mld_sumf_fact__
#define mld_sumf_solve_ mld_sumf_solve__
#define mld_sumf_free_ mld_sumf_free__
#endif
#ifdef LowerCase
#define mld_sumf_fact_ mld_sumf_fact
#define mld_sumf_solve_ mld_sumf_solve
#define mld_sumf_free_ mld_sumf_free
#endif
#ifdef UpperUndescore
#define mld_sumf_fact_ MLD_SUMF_FACT_
#define mld_sumf_solve_ MLD_SUMF_SOLVE_
#define mld_sumf_free_ MLD_SUMF_FREE_
#endif
#ifdef UpperFloatUndescore
#define mld_sumf_fact_ MLD_SUMF_FACT__
#define mld_sumf_solve_ MLD_SUMF_SOLVE__
#define mld_sumf_free_ MLD_SUMF_FREE__
#endif
#ifdef UpperCase
#define mld_sumf_fact_ MLD_SUMF_FACT
#define mld_sumf_solve_ MLD_SUMF_SOLVE
#define mld_sumf_free_ MLD_SUMF_FREE
#endif
#include <stdio.h> #include <stdio.h>
/* Currently no single precision version in UMFPACK */ /* Currently no single precision version in UMFPACK */
#ifdef Have_UMF_ #ifdef Have_UMF_
@ -119,139 +86,115 @@ Availability:
#include "umfpack.h" #include "umfpack.h"
#endif #endif
#ifdef Ptr64Bits
typedef long long fptr;
#else
typedef int fptr; /* 32-bit by default */
#endif
void int mld_sumf_fact(int n, int nnz,
mld_sumf_fact_(int *n, int *nnz, float *values, int *rowind, int *colptr,
float *values, int *rowind, int *colptr, void *symptr,
#ifdef Have_UMF_ void *numptr,
fptr *symptr, long long int *ssize,
fptr *numptr, long long int *nsize)
#else
void *symptr,
void *numptr,
#endif
int *info)
{ {
#ifdef Have_UMF_ #ifdef Have_UMF_
float Info [UMFPACK_INFO], Control [UMFPACK_CONTROL]; float Info [UMFPACK_INFO], Control [UMFPACK_CONTROL];
void *Symbolic, *Numeric ; void *Symbolic, *Numeric ;
int i; int i,info ;
umfpack_di_defaults(Control); umfpack_si_defaults(Control);
for (i = 0; i <= *n; ++i) --colptr[i]; info = umfpack_si_symbolic (n, n, colptr, rowind, values, &Symbolic,
for (i = 0; i < *nnz; ++i) --rowind[i];
*info = umfpack_di_symbolic (*n, *n, colptr, rowind, values, &Symbolic,
Control, Info); Control, Info);
if ( *info == UMFPACK_OK ) { if ( info == UMFPACK_OK ) {
*info = 0; info = 0;
} else { } else {
printf("umfpack_di_symbolic() error returns INFO= %d\n", *info); printf("umfpack_si_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_di_numeric (colptr, rowind, values, Symbolic, &Numeric, info = umfpack_si_numeric (colptr, rowind, values, 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_di_numeric() error returns INFO= %d\n", *info); printf("umfpack_si_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_sumf_solve(int itrans, int n,
mld_sumf_solve_(int *itrans, int *n, float *x, float *b, int ldb,
float *x, float *b, int *ldb, void *numptr)
#ifdef Have_UMF_
fptr *numptr,
#else
void *numptr,
#endif
int *info)
{ {
#ifdef Have_UMF_ #ifdef Have_UMF_
float Info [UMFPACK_INFO], Control [UMFPACK_CONTROL]; float 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_di_solve(trans,NULL,NULL,NULL, info = umfpack_si_solve(trans,NULL,NULL,NULL,
x,b,(void *) *numptr,Control,Info); x,b,(void *) *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_sumf_free(void *symptr, void *numptr)
mld_sumf_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_di_free_numeric(&Numeric); if (numptr != NULL) umfpack_si_free_numeric(&Numeric);
umfpack_di_free_symbolic(&Symbolic); if (symptr != NULL) umfpack_si_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
} }

@ -81,11 +81,6 @@ Availability:
#include "umfpack.h" #include "umfpack.h"
#endif #endif
#ifdef Ptr64Bits
typedef long long fptr;
#else
typedef int fptr; /* 32-bit by default */
#endif
int mld_zumf_fact(int n, int nnz, int mld_zumf_fact(int n, int nnz,
double *values, int *rowind, int *colptr, double *values, int *rowind, int *colptr,

Loading…
Cancel
Save