taucs.h
来自「finite element mesh 参数化有限元网格划分」· C头文件 代码 · 共 852 行 · 第 1/2 页
H
852 行
#define taucs_one taucs_zone_const
#define taucs_zero taucs_zzero_const
#elif defined(TAUCS_CORE_SCOMPLEX)
#define taucs_complex_create(r,i) taucs_ccomplex_create_fn(r,i)
#define taucs_add(x,y) taucs_cadd_fn(x,y)
#define taucs_sub(x,y) taucs_csub_fn(x,y)
#define taucs_mul(x,y) taucs_cmul_fn(x,y)
#define taucs_div(x,y) taucs_cdiv_fn(x,y)
#define taucs_neg(x) taucs_cneg_fn(x)
#define taucs_conj(x) taucs_cconj_fn(x)
#define taucs_abs(x) taucs_cabs_fn(x)
#define taucs_sqrt(x) taucs_csqrt_fn(x)
#define taucs_im(x) ((x).i)
#define taucs_re(x) ((x).r)
#define taucs_minusone taucs_cminusone_const
#define taucs_one taucs_cone_const
#define taucs_zero taucs_czero_const
#endif /* SCOMPLEX */
#endif
extern taucs_double taucs_dzero_const ;
extern taucs_double taucs_done_const ;
extern taucs_double taucs_dminusone_const;
extern taucs_single taucs_szero_const ;
extern taucs_single taucs_sone_const ;
extern taucs_single taucs_sminusone_const;
extern taucs_dcomplex taucs_zzero_const ;
extern taucs_dcomplex taucs_zone_const ;
extern taucs_dcomplex taucs_zminusone_const;
extern taucs_scomplex taucs_czero_const ;
extern taucs_scomplex taucs_cone_const ;
extern taucs_scomplex taucs_cminusone_const;
#define taucs_isnan(x) (isnan((double)(taucs_re(x))) || isnan((double)(taucs_im(x))))
#define taucs_isinf(x) (isinf((double)(taucs_re(x))) || isinf((double)(taucs_im(x))))
#ifdef TAUCS_CORE_SINGLE
#define taucs_zero_const taucs_szero_const
#define taucs_one_const taucs_sone_const
#define taucs_minusone_const taucs_sminusone_const
#define taucs_zero_real_const taucs_szero_const
#define taucs_one_real_const taucs_sone_const
#define taucs_minusone_real_const taucs_sminusone_const
#define taucs_gemm taucs_blas_name(sgemm)
#define taucs_potrf taucs_blas_name(spotrf)
#define taucs_herk taucs_blas_name(ssyrk)
#define taucs_trsm taucs_blas_name(strsm)
#endif
#ifdef TAUCS_CORE_DOUBLE
#define taucs_zero_const taucs_dzero_const
#define taucs_one_const taucs_done_const
#define taucs_minusone_const taucs_dminusone_const
#define taucs_zero_real_const taucs_dzero_const
#define taucs_one_real_const taucs_done_const
#define taucs_minusone_real_const taucs_dminusone_const
#define taucs_gemm taucs_blas_name(dgemm)
#define taucs_potrf taucs_blas_name(dpotrf)
#define taucs_herk taucs_blas_name(dsyrk)
#define taucs_trsm taucs_blas_name(dtrsm)
#endif
/*
#ifdef TAUCS_CORE_GENERAL
#define taucs_zero_const taucs_dzero_const
#define taucs_one_const taucs_done_const
#define taucs_minusone_const taucs_dminusone_const
#define taucs_zero_real_const taucs_dzero_const
#define taucs_one_real_const taucs_done_const
#define taucs_minusone_real_const taucs_dminusone_const
#endif
*/
#ifdef TAUCS_CORE_SCOMPLEX
#define taucs_zero_const taucs_czero_const
#define taucs_one_const taucs_cone_const
#define taucs_minusone_const taucs_cminusone_const
#define taucs_zero_real_const taucs_szero_const
#define taucs_one_real_const taucs_sone_const
#define taucs_minusone_real_const taucs_sminusone_const
#define taucs_gemm taucs_blas_name(cgemm)
#define taucs_potrf taucs_blas_name(cpotrf)
#define taucs_herk taucs_blas_name(cherk)
#define taucs_trsm taucs_blas_name(ctrsm)
#endif
#ifdef TAUCS_CORE_DCOMPLEX
#define taucs_zero_const taucs_zzero_const
#define taucs_one_const taucs_zone_const
#define taucs_minusone_const taucs_zminusone_const
#define taucs_zero_real_const taucs_dzero_const
#define taucs_one_real_const taucs_done_const
#define taucs_minusone_real_const taucs_dminusone_const
#define taucs_gemm taucs_blas_name(zgemm)
#define taucs_potrf taucs_blas_name(zpotrf)
#define taucs_herk taucs_blas_name(zherk)
#define taucs_trsm taucs_blas_name(ztrsm)
#endif
/*********************************************************/
/* */
/*********************************************************/
typedef struct
{
int n; /* columns */
int m; /* rows; don't use if symmetric */
int flags;
int* colptr; /* pointers to where columns begin in rowind and values. */
/* 0-based. Length is (n+1). */
int* rowind; /* row indices */
union {
void* v;
taucs_double* d;
taucs_single* s;
taucs_dcomplex* z;
taucs_scomplex* c;
} values;
} taucs_ccs_matrix;
typedef struct {
int type;
int nmatrices;
void* type_specific;
/* the following may change! do not rely on them. */
double nreads, nwrites, bytes_read, bytes_written, read_time, write_time;
} taucs_io_handle;
/* generate all the prototypes */
#define taucs_datatype taucs_double
#define taucs_real_datatype taucs_double
#define taucs_dtl(X) taucs_d##X
#include "taucs_private.h"
#undef taucs_real_datatype
#undef taucs_datatype
#undef taucs_dtl
#define taucs_datatype taucs_single
#define taucs_real_datatype taucs_single
#define taucs_dtl(X) taucs_s##X
#include "taucs_private.h"
#undef taucs_real_datatype
#undef taucs_datatype
#undef taucs_dtl
#define taucs_datatype taucs_dcomplex
#define taucs_real_datatype taucs_double
#define taucs_dtl(X) taucs_z##X
#include "taucs_private.h"
#undef taucs_real_datatype
#undef taucs_datatype
#undef taucs_dtl
#define taucs_datatype taucs_scomplex
#define taucs_real_datatype taucs_single
#define taucs_dtl(X) taucs_c##X
#include "taucs_private.h"
#undef taucs_real_datatype
#undef taucs_datatype
#undef taucs_dtl
/*********************************************************/
/* */
/*********************************************************/
/* now define the data type for the file that we compile now */
#ifdef TAUCS_CORE_DOUBLE
#define TAUCS_CORE
#define TAUCS_CORE_REAL
#define TAUCS_CORE_DATATYPE TAUCS_DOUBLE
typedef taucs_double taucs_datatype;
#define taucs_dtl(X) taucs_d##X
#define taucs_values values.d
#define taucs_iszero(x) ((x) == 0.0)
typedef double taucs_real_datatype; /* omer: this is the datatype of the real and imaginary part of the datatype*/
#endif
#ifdef TAUCS_CORE_GENERAL
#define TAUCS_CORE
#define TAUCS_CORE_DATATYPE TAUCS_DOUBLE
typedef taucs_double taucs_datatype;
typedef double taucs_real_datatype;
/*
#define TAUCS_CORE_REAL
#define TAUCS_CORE_DATATYPE TAUCS_DOUBLE
#define taucs_values values.d
#define taucs_dtl(X) taucs_g##X
#define taucs_iszero(x) ((x) == 0.0)
*/
#endif
#ifdef TAUCS_CORE_SINGLE
#define TAUCS_CORE
#define TAUCS_CORE_REAL
#define TAUCS_CORE_DATATYPE TAUCS_SINGLE
typedef taucs_single taucs_datatype;
#define taucs_dtl(X) taucs_s##X
#define taucs_values values.s
#define taucs_iszero(x) ((x) == 0.0f)
typedef float taucs_real_datatype; /* omer: this is the datatype of the real and imaginary part of the datatype*/
#endif
#ifdef TAUCS_CORE_DCOMPLEX
#define TAUCS_CORE
#define TAUCS_CORE_COMPLEX
#define TAUCS_CORE_DATATYPE TAUCS_DCOMPLEX
typedef taucs_dcomplex taucs_datatype;
#define taucs_dtl(X) taucs_z##X
#define taucs_values values.z
#define taucs_iszero(x) (taucs_re(x) == 0.0 && taucs_im(x) == 0.0)
typedef double taucs_real_datatype; /* omer: this is the datatype of the real and imaginary part of the datatype*/
#endif
#ifdef TAUCS_CORE_SCOMPLEX
#define TAUCS_CORE
#define TAUCS_CORE_COMPLEX
#define TAUCS_CORE_DATATYPE TAUCS_SCOMPLEX
typedef taucs_scomplex taucs_datatype;
#define taucs_dtl(X) taucs_c##X
#define taucs_values values.c
#define taucs_iszero(x) (taucs_re(x) == 0.0f && taucs_im(x) == 0.0f)
typedef float taucs_real_datatype; /* omer: this is the datatype of the real and imaginary part of the datatype*/
#endif
#ifndef TAUCS_CORE_DATATYPE
typedef taucs_double taucs_datatype;
typedef double taucs_real_datatype;
#endif
/*********************************************************/
/* */
/*********************************************************/
double taucs_get_nan(void);
/*
routines for testing memory allocation.
Mostly useful for testing programs
that hunt for memory leaks.
*/
double taucs_allocation_amount(void);
int taucs_allocation_count(void);
int taucs_allocation_attempts(void);
void taucs_allocation_assert_clean(void);
void taucs_allocation_mark_clean(void);
void taucs_allocation_induce_failure(int i);
/*
these are meant to allow allocation
and more importantly, deallocation,
within the testing programs.
*/
void* taucs_malloc (size_t size) ;
void* taucs_calloc (size_t nmemb, size_t size);
void* taucs_realloc(void* ptr, size_t size) ;
void taucs_free (void* ptr) ;
#if defined(TAUCS_CORE)
#if defined(TAUCS_MEMORY_TEST_yes)
void* taucs_internal_calloc(size_t nmemb, size_t size,char* file, int line);
void* taucs_internal_malloc(size_t size, char* file, int line);
void* taucs_internal_realloc(void *ptr, size_t size, char* file, int line);
void taucs_internal_free(void *ptr, char* file, int line);
/*
#define realloc(x,y) taucs_internal_realloc(x,y,__FILE__,__LINE__)
#define malloc(x) taucs_internal_malloc(x,__FILE__,__LINE__)
#define calloc(x,y) taucs_internal_calloc(x,y,__FILE__,__LINE__)
#define free(x) taucs_internal_free(x,__FILE__,__LINE__)
*/
#define taucs_realloc(x,y) taucs_internal_realloc(x,y,__FILE__,__LINE__)
#define taucs_malloc(x) taucs_internal_malloc(x,__FILE__,__LINE__)
#define taucs_calloc(x,y) taucs_internal_calloc(x,y,__FILE__,__LINE__)
#define taucs_free(x) taucs_internal_free(x,__FILE__,__LINE__)
#define realloc(x,y) taucs_must_not_call_realloc_directly(x,y)
#define malloc(x) taucs_must_not_call_malloc_directly(x)
#define calloc(x,y) taucs_must_not_call_calloc_directly(x,y)
#define free(x) taucs_must_not_call_free_directly(x)
#else /* TAUCS_CORE, but not memory testing */
void* taucs_calloc_stub(size_t nmemb, size_t size);
void* taucs_malloc_stub(size_t size);
void* taucs_realloc_stub(void *ptr, size_t size);
void taucs_free_stub(void *ptr);
#define realloc(x,y) taucs_must_not_call_realloc_directly(x,y)
#define malloc(x) taucs_must_not_call_malloc_directly(x)
#define calloc(x,y) taucs_must_not_call_calloc_directly(x,y)
#define free(x) taucs_must_not_call_free_directly(x)
#define taucs_realloc(x,y) taucs_realloc_stub(x,y)
#define taucs_malloc(x) taucs_malloc_stub(x)
#define taucs_calloc(x,y) taucs_calloc_stub(x,y)
#define taucs_free(x) taucs_free_stub(x)
#endif
#endif
/*********************************************************/
/* */
/*********************************************************/
#ifndef max
#define max(x,y) ( ((x) > (y)) ? (x) : (y) )
#endif
#ifndef min
#define min(x,y) ( ((x) < (y)) ? (x) : (y) )
#endif
/*********************************************************/
/* */
/*********************************************************/
/* externs */
extern int ireadhb_(char*, char*, int*, int*, int*);
extern int creadhb_(char*, int*, int*, int*, int*, int*, taucs_scomplex*);
extern int dreadhb_(char*, int*, int*, int*, int*, int*, taucs_double*);
extern int sreadhb_(char*, int*, int*, int*, int*, int*, taucs_single*);
extern int zreadhb_(char*, int*, int*, int*, int*, int*, taucs_dcomplex*);
extern int amdexa_(int*, int*, int*, int*, int*, int*, int*, int*, int*,
int*, int*, int*, int*, int*, int*);
extern int amdtru_(int*, int*, int*, int*, int*, int*, int*, int*, int*,
int*, int*, int*, int*, int*, int*);
extern int amdbar_(int*, int*, int*, int*, int*, int*, int*, int*, int*,
int*, int*, int*, int*, int*, int*);
extern int genmmd_(int*, int*, int*, int*, int*, int*, int*, int*, int*,
int*, int*, int*);
/*********************************************************/
/* */
/*********************************************************/
#if (defined(OSTYPE_irix) || defined(OSTYPE_solaris))
#include <math.h>
#include <ieeefp.h>
#define isinf(x) (!finite((x)) && !isnan((x)))
#elif defined(OSTYPE_win32)
#define isnan(x) (_isnan(x))
#define isinf(x) (!(_finite(x)) && !(_isnan(x)))
#define finite(x) (_finite(x))
#endif
/* If these are mactors (e.g., gcc -std=c99), do not declare */
/* otherwise, declare them, since they are not always declared */
/* in math.h (e.g., gcc -std=c89 -pedantic); these are for */
/* gcc 3.3.1 */
#ifndef isnan
extern int isnan(double);
#endif
#ifndef finite
extern int finite(double);
#endif
#ifndef isinf
extern int isinf(double);
#endif
extern int taucs_potrf(char*, int*, taucs_datatype*, int*, int*);
extern int taucs_trsm(char *, char *, char *, char *,
int*, int*, taucs_datatype*, taucs_datatype*, int *,
taucs_datatype*, int *);
extern int taucs_gemm(char *, char *, int*, int*, int *,
taucs_datatype*, taucs_datatype*, int *, taucs_datatype*, int *,
taucs_datatype*, taucs_datatype*, int*);
extern int taucs_herk(char *, char *,
int *, int *,
taucs_real_datatype*,
taucs_datatype*, int *,
taucs_real_datatype*,
taucs_datatype*, int *);
taucs_double taucs_blas_name(dnrm2)(int*, taucs_double*, int*);
taucs_single taucs_blas_name(snrm2)(int*, taucs_single*, int*);
taucs_double taucs_blas_name(dznrm2)(int*, taucs_dcomplex*, int*);
taucs_single taucs_blas_name(scnrm2)(int*, taucs_scomplex*, int*);
/*********************************************************/
/* */
/*********************************************************/
#undef min
#undef max
#ifdef __cplusplus
} // extern C
#endif
#endif // ifndef TAUCS_H
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?