libsc
1.6.0
|
00001 /* 00002 This file is part of the SC Library. 00003 The SC Library provides support for parallel scientific applications. 00004 00005 Copyright (C) 2010 The University of Texas System 00006 00007 The SC Library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Lesser General Public 00009 License as published by the Free Software Foundation; either 00010 version 2.1 of the License, or (at your option) any later version. 00011 00012 The SC Library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public 00018 License along with the SC Library; if not, write to the Free Software 00019 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00020 02110-1301, USA. 00021 */ 00022 00023 #ifndef SC_BLAS_H 00024 #define SC_BLAS_H 00025 00026 #include <sc.h> 00027 00028 SC_EXTERN_C_BEGIN; 00029 00030 typedef int sc_bint_t; /* Integer type for all of the blas calls */ 00031 typedef unsigned int sc_buint_t; /* Unsigned Integer type for blas */ 00032 00033 typedef enum sc_trans 00034 { 00035 SC_NO_TRANS, 00036 SC_TRANS, 00037 SC_TRANS_ANCHOR 00038 } 00039 sc_trans_t; 00040 00041 typedef enum sc_uplo 00042 { 00043 SC_UPPER, 00044 SC_LOWER, 00045 SC_UPLO_ANCHOR 00046 } 00047 sc_uplo_t; 00048 00049 typedef enum sc_cmach 00050 { 00051 SC_CMACH_EPS, /* relative machine precision */ 00052 SC_CMACH_SFMIN, /* safe minimum, such that 1/sfmin does not 00053 * overflow 00054 */ 00055 SC_CMACH_BASE, /* base of the machine */ 00056 SC_CMACH_PREC, /* eps*base */ 00057 SC_CMACH_T, /* number of (base) digits in the mantissa */ 00058 SC_CMACH_RND, /* 1.0 when rounding occurs in addition, 00059 * 0.0 otherwise 00060 */ 00061 SC_CMACH_EMIN, /* minimum exponent before (gradual) 00062 * underflow 00063 */ 00064 SC_CMACH_RMIN, /* underflow threshold - base**(emin-1) */ 00065 SC_CMACH_EMAX, /* largest exponent before overflow */ 00066 SC_CMACH_RMAX, /* overflow threshold - (base**emax)*(1-eps) */ 00067 SC_CMACH_ANCHOR 00068 } 00069 sc_cmach_t; 00070 00071 extern const char sc_transchar[]; 00072 extern const char sc_antitranschar[]; /* does not work for complex */ 00073 extern const char sc_uplochar[]; 00074 extern const char sc_cmachchar[]; 00075 00076 #ifdef SC_WITH_BLAS 00077 00078 #ifndef SC_F77_FUNC 00079 #define SC_F77_FUNC(small,CAPS) small ## _ 00080 #endif 00081 00082 #define SC_BLAS_DLAMCH SC_F77_FUNC(dlamch,DLAMCH) 00083 #define SC_BLAS_DSCAL SC_F77_FUNC(dscal,DSCAL) 00084 #define SC_BLAS_DCOPY SC_F77_FUNC(dcopy,DCOPY) 00085 #define SC_BLAS_DAXPY SC_F77_FUNC(daxpy,DAXPY) 00086 #define SC_BLAS_DDOT SC_F77_FUNC(ddot,DDOT) 00087 #define SC_BLAS_DGEMV SC_F77_FUNC(dgemv,DGEMV) 00088 #define SC_BLAS_DGEMM SC_F77_FUNC(dgemm,DGEMM) 00089 00090 double SC_BLAS_DLAMCH (const char *cmach); 00091 void SC_BLAS_DSCAL (const sc_bint_t * n, const double *alpha, 00092 double *X, const sc_bint_t * incx); 00093 void SC_BLAS_DCOPY (const sc_bint_t * n, 00094 const double *X, const sc_bint_t * incx, 00095 double *Y, const sc_bint_t * incy); 00096 void SC_BLAS_DAXPY (const sc_bint_t * n, const double *alpha, 00097 const double *X, const sc_bint_t * incx, 00098 double *Y, const sc_bint_t * incy); 00099 double SC_BLAS_DDOT (const sc_bint_t * n, const double *X, 00100 const sc_bint_t * incx, const double *Y, 00101 const sc_bint_t * incy); 00102 00103 void SC_BLAS_DGEMV (const char *transa, const sc_bint_t * m, 00104 const sc_bint_t * n, const double *alpha, 00105 const double *a, const sc_bint_t * lda, 00106 const double *x, const sc_bint_t * incx, 00107 const double *beta, double *y, 00108 const sc_bint_t * incy); 00109 00110 void SC_BLAS_DGEMM (const char *transa, const char *transb, 00111 const sc_bint_t * m, const sc_bint_t * n, 00112 const sc_bint_t * k, const double *alpha, 00113 const double *a, const sc_bint_t * lda, 00114 const double *b, const sc_bint_t * ldb, 00115 const double *beta, double *c, 00116 const sc_bint_t * ldc); 00117 00118 #else /* !SC_WITH_BLAS */ 00119 00120 #define SC_BLAS_DLAMCH (double) sc_blas_nonimplemented 00121 #define SC_BLAS_DSCAL (void) sc_blas_nonimplemented 00122 #define SC_BLAS_DCOPY (void) sc_blas_nonimplemented 00123 #define SC_BLAS_DAXPY (void) sc_blas_nonimplemented 00124 #define SC_BLAS_DDOT (double) sc_blas_nonimplemented 00125 #define SC_BLAS_DGEMM (void) sc_blas_nonimplemented 00126 #define SC_BLAS_DGEMV (void) sc_blas_nonimplemented 00127 00128 int sc_blas_nonimplemented (); 00129 00130 #endif 00131 00132 SC_EXTERN_C_END; 00133 00134 #endif /* !SC_BLAS_H */