00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef CHOLMOD_BLAS_H
00017 #define CHOLMOD_BLAS_H
00018
00019
00020
00021
00022
00023 #if defined (__sun) || defined (MSOL2) || defined (ARCH_SOL2)
00024 #define CHOLMOD_SOL2
00025 #define CHOLMOD_ARCHITECTURE "Sun Solaris"
00026
00027 #elif defined (__sgi) || defined (MSGI) || defined (ARCH_SGI)
00028 #define CHOLMOD_SGI
00029 #define CHOLMOD_ARCHITECTURE "SGI Irix"
00030
00031 #elif defined (__linux) || defined (MGLNX86) || defined (ARCH_GLNX86)
00032 #define CHOLMOD_LINUX
00033 #define CHOLMOD_ARCHITECTURE "Linux"
00034
00035 #elif defined (_AIX) || defined (MIBM_RS) || defined (ARCH_IBM_RS)
00036 #define CHOLMOD_AIX
00037 #define CHOLMOD_ARCHITECTURE "IBM AIX"
00038
00039
00040
00041 #elif defined (__alpha) || defined (MALPHA) || defined (ARCH_ALPHA)
00042 #define CHOLMOD_ALPHA
00043 #define CHOLMOD_ARCHITECTURE "Compaq Alpha"
00044
00045 #elif defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64)
00046 #if defined (__MINGW32__) || defined (__MINGW32__)
00047 #define CHOLMOD_MINGW
00048 #elif defined (__CYGWIN32__) || defined (__CYGWIN32__)
00049 #define CHOLMOD_CYGWIN
00050 #else
00051 #define CHOLMOD_WINDOWS
00052 #define BLAS_NO_UNDERSCORE
00053 #endif
00054 #define CHOLMOD_ARCHITECTURE "Microsoft Windows"
00055
00056 #elif defined (__hppa) || defined (__hpux) || defined (MHPUX) || defined (ARCH_HPUX)
00057 #define CHOLMOD_HP
00058 #define CHOLMOD_ARCHITECTURE "HP Unix"
00059 #define BLAS_NO_UNDERSCORE
00060
00061 #elif defined (__hp700) || defined (MHP700) || defined (ARCH_HP700)
00062 #define CHOLMOD_HP
00063 #define CHOLMOD_ARCHITECTURE "HP 700 Unix"
00064 #define BLAS_NO_UNDERSCORE
00065
00066 #else
00067
00068
00069 #define CHOLMOD_ARCHITECTURE "unknown"
00070 #endif
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080 #if defined(CHOLMOD_SOL2) && !defined(NSUNPERF) && defined(LONG) && defined(LONGBLAS)
00081 #define SUN64
00082 #endif
00083
00084 #ifdef SUN64
00085
00086 #define BLAS_DTRSV dtrsv_64_
00087 #define BLAS_DGEMV dgemv_64_
00088 #define BLAS_DTRSM dtrsm_64_
00089 #define BLAS_DGEMM dgemm_64_
00090 #define BLAS_DSYRK dsyrk_64_
00091 #define BLAS_DGER dger_64_
00092 #define BLAS_DSCAL dscal_64_
00093 #define LAPACK_DPOTRF dpotrf_64_
00094
00095 #define BLAS_ZTRSV ztrsv_64_
00096 #define BLAS_ZGEMV zgemv_64_
00097 #define BLAS_ZTRSM ztrsm_64_
00098 #define BLAS_ZGEMM zgemm_64_
00099 #define BLAS_ZHERK zherk_64_
00100 #define BLAS_ZGER zgeru_64_
00101 #define BLAS_ZSCAL zscal_64_
00102 #define LAPACK_ZPOTRF zpotrf_64_
00103
00104 #elif defined (BLAS_NO_UNDERSCORE)
00105
00106 #define BLAS_DTRSV dtrsv
00107 #define BLAS_DGEMV dgemv
00108 #define BLAS_DTRSM dtrsm
00109 #define BLAS_DGEMM dgemm
00110 #define BLAS_DSYRK dsyrk
00111 #define BLAS_DGER dger
00112 #define BLAS_DSCAL dscal
00113 #define LAPACK_DPOTRF dpotrf
00114
00115 #define BLAS_ZTRSV ztrsv
00116 #define BLAS_ZGEMV zgemv
00117 #define BLAS_ZTRSM ztrsm
00118 #define BLAS_ZGEMM zgemm
00119 #define BLAS_ZHERK zherk
00120 #define BLAS_ZGER zgeru
00121 #define BLAS_ZSCAL zscal
00122 #define LAPACK_ZPOTRF zpotrf
00123
00124 #else
00125
00126 #define BLAS_DTRSV dtrsv_
00127 #define BLAS_DGEMV dgemv_
00128 #define BLAS_DTRSM dtrsm_
00129 #define BLAS_DGEMM dgemm_
00130 #define BLAS_DSYRK dsyrk_
00131 #define BLAS_DGER dger_
00132 #define BLAS_DSCAL dscal_
00133 #define LAPACK_DPOTRF dpotrf_
00134
00135 #define BLAS_ZTRSV ztrsv_
00136 #define BLAS_ZGEMV zgemv_
00137 #define BLAS_ZTRSM ztrsm_
00138 #define BLAS_ZGEMM zgemm_
00139 #define BLAS_ZHERK zherk_
00140 #define BLAS_ZGER zgeru_
00141 #define BLAS_ZSCAL zscal_
00142 #define LAPACK_ZPOTRF zpotrf_
00143
00144 #endif
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157 #if defined (LONGBLAS) && defined (LONG)
00158 #define BLAS_INT LONGBLAS
00159 #else
00160 #define BLAS_INT int
00161 #endif
00162
00163
00164
00165
00166
00167
00168
00169
00170 #define CHECK_BLAS_INT (sizeof (BLAS_INT) < sizeof (Int))
00171 #define EQ(K,k) (((BLAS_INT) K) == ((Int) k))
00172
00173
00174
00175
00176
00177 void BLAS_DGEMV (char *trans, BLAS_INT *m, BLAS_INT *n, double *alpha,
00178 double *A, BLAS_INT *lda, double *X, BLAS_INT *incx, double *beta,
00179 double *Y, BLAS_INT *incy) ;
00180
00181 #define BLAS_dgemv(trans,m,n,alpha,A,lda,X,incx,beta,Y,incy) \
00182 { \
00183 BLAS_INT M = m, N = n, LDA = lda, INCX = incx, INCY = incy ; \
00184 if (CHECK_BLAS_INT && !(EQ (M,m) && EQ (N,n) && EQ (LDA,lda) && \
00185 EQ (INCX,incx) && EQ (INCY,incy))) \
00186 { \
00187 Common->blas_ok = FALSE ; \
00188 } \
00189 if (!CHECK_BLAS_INT || Common->blas_ok) \
00190 { \
00191 BLAS_DGEMV (trans, &M, &N, alpha, A, &LDA, X, &INCX, beta, Y, &INCY) ; \
00192 } \
00193 }
00194
00195 void BLAS_ZGEMV (char *trans, BLAS_INT *m, BLAS_INT *n, double *alpha,
00196 double *A, BLAS_INT *lda, double *X, BLAS_INT *incx, double *beta,
00197 double *Y, BLAS_INT *incy) ;
00198
00199 #define BLAS_zgemv(trans,m,n,alpha,A,lda,X,incx,beta,Y,incy) \
00200 { \
00201 BLAS_INT M = m, N = n, LDA = lda, INCX = incx, INCY = incy ; \
00202 if (CHECK_BLAS_INT && !(EQ (M,m) && EQ (N,n) && EQ (LDA,lda) && \
00203 EQ (INCX,incx) && EQ (INCY,incy))) \
00204 { \
00205 Common->blas_ok = FALSE ; \
00206 } \
00207 if (!CHECK_BLAS_INT || Common->blas_ok) \
00208 { \
00209 BLAS_ZGEMV (trans, &M, &N, alpha, A, &LDA, X, &INCX, beta, Y, &INCY) ; \
00210 } \
00211 }
00212
00213 void BLAS_DTRSV (char *uplo, char *trans, char *diag, BLAS_INT *n, double *A,
00214 BLAS_INT *lda, double *X, BLAS_INT *incx) ;
00215
00216 #define BLAS_dtrsv(uplo,trans,diag,n,A,lda,X,incx) \
00217 { \
00218 BLAS_INT N = n, LDA = lda, INCX = incx ; \
00219 if (CHECK_BLAS_INT && !(EQ (N,n) && EQ (LDA,lda) && EQ (INCX,incx))) \
00220 { \
00221 Common->blas_ok = FALSE ; \
00222 } \
00223 if (!CHECK_BLAS_INT || Common->blas_ok) \
00224 { \
00225 BLAS_DTRSV (uplo, trans, diag, &N, A, &LDA, X, &INCX) ; \
00226 } \
00227 }
00228
00229 void BLAS_ZTRSV (char *uplo, char *trans, char *diag, BLAS_INT *n, double *A,
00230 BLAS_INT *lda, double *X, BLAS_INT *incx) ;
00231
00232 #define BLAS_ztrsv(uplo,trans,diag,n,A,lda,X,incx) \
00233 { \
00234 BLAS_INT N = n, LDA = lda, INCX = incx ; \
00235 if (CHECK_BLAS_INT && !(EQ (N,n) && EQ (LDA,lda) && EQ (INCX,incx))) \
00236 { \
00237 Common->blas_ok = FALSE ; \
00238 } \
00239 if (!CHECK_BLAS_INT || Common->blas_ok) \
00240 { \
00241 BLAS_ZTRSV (uplo, trans, diag, &N, A, &LDA, X, &INCX) ; \
00242 } \
00243 }
00244
00245 void BLAS_DTRSM (char *side, char *uplo, char *transa, char *diag, BLAS_INT *m,
00246 BLAS_INT *n, double *alpha, double *A, BLAS_INT *lda, double *B,
00247 BLAS_INT *ldb) ;
00248
00249 #define BLAS_dtrsm(side,uplo,transa,diag,m,n,alpha,A,lda,B,ldb) \
00250 { \
00251 BLAS_INT M = m, N = n, LDA = lda, LDB = ldb ; \
00252 if (CHECK_BLAS_INT && !(EQ (M,m) && EQ (N,n) && EQ (LDA,lda) && \
00253 EQ (LDB,ldb))) \
00254 { \
00255 Common->blas_ok = FALSE ; \
00256 } \
00257 if (!CHECK_BLAS_INT || Common->blas_ok) \
00258 { \
00259 BLAS_DTRSM (side, uplo, transa, diag, &M, &N, alpha, A, &LDA, B, &LDB);\
00260 } \
00261 }
00262
00263 void BLAS_ZTRSM (char *side, char *uplo, char *transa, char *diag, BLAS_INT *m,
00264 BLAS_INT *n, double *alpha, double *A, BLAS_INT *lda, double *B,
00265 BLAS_INT *ldb) ;
00266
00267 #define BLAS_ztrsm(side,uplo,transa,diag,m,n,alpha,A,lda,B,ldb) \
00268 { \
00269 BLAS_INT M = m, N = n, LDA = lda, LDB = ldb ; \
00270 if (CHECK_BLAS_INT && !(EQ (M,m) && EQ (N,n) && EQ (LDA,lda) && \
00271 EQ (LDB,ldb))) \
00272 { \
00273 Common->blas_ok = FALSE ; \
00274 } \
00275 if (!CHECK_BLAS_INT || Common->blas_ok) \
00276 { \
00277 BLAS_ZTRSM (side, uplo, transa, diag, &M, &N, alpha, A, &LDA, B, &LDB);\
00278 } \
00279 }
00280
00281 void BLAS_DGEMM (char *transa, char *transb, BLAS_INT *m, BLAS_INT *n,
00282 BLAS_INT *k, double *alpha, double *A, BLAS_INT *lda, double *B,
00283 BLAS_INT *ldb, double *beta, double *C, BLAS_INT *ldc) ;
00284
00285 #define BLAS_dgemm(transa,transb,m,n,k,alpha,A,lda,B,ldb,beta,C,ldc) \
00286 { \
00287 BLAS_INT M = m, N = n, K = k, LDA = lda, LDB = ldb, LDC = ldc ; \
00288 if (CHECK_BLAS_INT && !(EQ (M,m) && EQ (N,n) && EQ (K,k) && \
00289 EQ (LDA,lda) && EQ (LDB,ldb) && EQ (LDC,ldc))) \
00290 { \
00291 Common->blas_ok = FALSE ; \
00292 } \
00293 if (!CHECK_BLAS_INT || Common->blas_ok) \
00294 { \
00295 BLAS_DGEMM (transa, transb, &M, &N, &K, alpha, A, &LDA, B, &LDB, beta, \
00296 C, &LDC) ; \
00297 } \
00298 }
00299
00300 void BLAS_ZGEMM (char *transa, char *transb, BLAS_INT *m, BLAS_INT *n,
00301 BLAS_INT *k, double *alpha, double *A, BLAS_INT *lda, double *B,
00302 BLAS_INT *ldb, double *beta, double *C, BLAS_INT *ldc) ;
00303
00304 #define BLAS_zgemm(transa,transb,m,n,k,alpha,A,lda,B,ldb,beta,C,ldc) \
00305 { \
00306 BLAS_INT M = m, N = n, K = k, LDA = lda, LDB = ldb, LDC = ldc ; \
00307 if (CHECK_BLAS_INT && !(EQ (M,m) && EQ (N,n) && EQ (K,k) && \
00308 EQ (LDA,lda) && EQ (LDB,ldb) && EQ (LDC,ldc))) \
00309 { \
00310 Common->blas_ok = FALSE ; \
00311 } \
00312 if (!CHECK_BLAS_INT || Common->blas_ok) \
00313 { \
00314 BLAS_ZGEMM (transa, transb, &M, &N, &K, alpha, A, &LDA, B, &LDB, beta, \
00315 C, &LDC) ; \
00316 } \
00317 }
00318
00319 void BLAS_DSYRK (char *uplo, char *trans, BLAS_INT *n, BLAS_INT *k,
00320 double *alpha, double *A, BLAS_INT *lda, double *beta, double *C,
00321 BLAS_INT *ldc) ;
00322
00323 #define BLAS_dsyrk(uplo,trans,n,k,alpha,A,lda,beta,C,ldc) \
00324 { \
00325 BLAS_INT N = n, K = k, LDA = lda, LDC = ldc ; \
00326 if (CHECK_BLAS_INT && !(EQ (N,n) && EQ (K,k) && EQ (LDA,lda) && \
00327 EQ (LDC,ldc))) \
00328 { \
00329 Common->blas_ok = FALSE ; \
00330 } \
00331 if (!CHECK_BLAS_INT || Common->blas_ok) \
00332 { \
00333 BLAS_DSYRK (uplo, trans, &N, &K, alpha, A, &LDA, beta, C, &LDC) ; \
00334 } \
00335 } \
00336
00337 void BLAS_ZHERK (char *uplo, char *trans, BLAS_INT *n, BLAS_INT *k,
00338 double *alpha, double *A, BLAS_INT *lda, double *beta, double *C,
00339 BLAS_INT *ldc) ;
00340
00341 #define BLAS_zherk(uplo,trans,n,k,alpha,A,lda,beta,C,ldc) \
00342 { \
00343 BLAS_INT N = n, K = k, LDA = lda, LDC = ldc ; \
00344 if (CHECK_BLAS_INT && !(EQ (N,n) && EQ (K,k) && EQ (LDA,lda) && \
00345 EQ (LDC,ldc))) \
00346 { \
00347 Common->blas_ok = FALSE ; \
00348 } \
00349 if (!CHECK_BLAS_INT || Common->blas_ok) \
00350 { \
00351 BLAS_ZHERK (uplo, trans, &N, &K, alpha, A, &LDA, beta, C, &LDC) ; \
00352 } \
00353 } \
00354
00355 void LAPACK_DPOTRF (char *uplo, BLAS_INT *n, double *A, BLAS_INT *lda,
00356 BLAS_INT *info) ;
00357
00358 #define LAPACK_dpotrf(uplo,n,A,lda,info) \
00359 { \
00360 BLAS_INT N = n, LDA = lda, INFO = 1 ; \
00361 if (CHECK_BLAS_INT && !(EQ (N,n) && EQ (LDA,lda))) \
00362 { \
00363 Common->blas_ok = FALSE ; \
00364 } \
00365 if (!CHECK_BLAS_INT || Common->blas_ok) \
00366 { \
00367 LAPACK_DPOTRF (uplo, &N, A, &LDA, &INFO) ; \
00368 } \
00369 info = INFO ; \
00370 }
00371
00372 void LAPACK_ZPOTRF (char *uplo, BLAS_INT *n, double *A, BLAS_INT *lda,
00373 BLAS_INT *info) ;
00374
00375 #define LAPACK_zpotrf(uplo,n,A,lda,info) \
00376 { \
00377 BLAS_INT N = n, LDA = lda, INFO = 1 ; \
00378 if (CHECK_BLAS_INT && !(EQ (N,n) && EQ (LDA,lda))) \
00379 { \
00380 Common->blas_ok = FALSE ; \
00381 } \
00382 if (!CHECK_BLAS_INT || Common->blas_ok) \
00383 { \
00384 LAPACK_ZPOTRF (uplo, &N, A, &LDA, &INFO) ; \
00385 } \
00386 info = INFO ; \
00387 }
00388
00389
00390
00391 void BLAS_DSCAL (BLAS_INT *n, double *alpha, double *Y, BLAS_INT *incy) ;
00392
00393 #define BLAS_dscal(n,alpha,Y,incy) \
00394 { \
00395 BLAS_INT N = n, INCY = incy ; \
00396 if (CHECK_BLAS_INT && !(EQ (N,n) && EQ (INCY,incy))) \
00397 { \
00398 Common->blas_ok = FALSE ; \
00399 } \
00400 if (!CHECK_BLAS_INT || Common->blas_ok) \
00401 { \
00402 BLAS_DSCAL (&N, alpha, Y, &INCY) ; \
00403 } \
00404 }
00405
00406 void BLAS_ZSCAL (BLAS_INT *n, double *alpha, double *Y, BLAS_INT *incy) ;
00407
00408 #define BLAS_zscal(n,alpha,Y,incy) \
00409 { \
00410 BLAS_INT N = n, INCY = incy ; \
00411 if (CHECK_BLAS_INT && !(EQ (N,n) && EQ (INCY,incy))) \
00412 { \
00413 Common->blas_ok = FALSE ; \
00414 } \
00415 if (!CHECK_BLAS_INT || Common->blas_ok) \
00416 { \
00417 BLAS_ZSCAL (&N, alpha, Y, &INCY) ; \
00418 } \
00419 }
00420
00421 void BLAS_DGER (BLAS_INT *m, BLAS_INT *n, double *alpha,
00422 double *X, BLAS_INT *incx, double *Y, BLAS_INT *incy,
00423 double *A, BLAS_INT *lda) ;
00424
00425 #define BLAS_dger(m,n,alpha,X,incx,Y,incy,A,lda) \
00426 { \
00427 BLAS_INT M = m, N = n, LDA = lda, INCX = incx, INCY = incy ; \
00428 if (CHECK_BLAS_INT && !(EQ (M,m) && EQ (N,n) && EQ (LDA,lda) && \
00429 EQ (INCX,incx) && EQ (INCY,incy))) \
00430 { \
00431 Common->blas_ok = FALSE ; \
00432 } \
00433 if (!CHECK_BLAS_INT || Common->blas_ok) \
00434 { \
00435 BLAS_DGER (&M, &N, alpha, X, &INCX, Y, &INCY, A, &LDA) ; \
00436 } \
00437 }
00438
00439 void BLAS_ZGER (BLAS_INT *m, BLAS_INT *n, double *alpha,
00440 double *X, BLAS_INT *incx, double *Y, BLAS_INT *incy,
00441 double *A, BLAS_INT *lda) ;
00442
00443 #define BLAS_zgeru(m,n,alpha,X,incx,Y,incy,A,lda) \
00444 { \
00445 BLAS_INT M = m, N = n, LDA = lda, INCX = incx, INCY = incy ; \
00446 if (CHECK_BLAS_INT && !(EQ (M,m) && EQ (N,n) && EQ (LDA,lda) && \
00447 EQ (INCX,incx) && EQ (INCY,incy))) \
00448 { \
00449 Common->blas_ok = FALSE ; \
00450 } \
00451 if (!CHECK_BLAS_INT || Common->blas_ok) \
00452 { \
00453 BLAS_ZGER (&M, &N, alpha, X, &INCX, Y, &INCY, A, &LDA) ; \
00454 } \
00455 }
00456
00457 #endif