xref: /petsc/include/petscblaslapack.h (revision 4ce68768e41e382c1fc596e135fd299def09fddc)
1a1e12872SBarry Smith /*
2c0581c19SLois Curfman McInnes    This file provides some name space protection from LAPACK and BLAS and
3c0581c19SLois Curfman McInnes allows the appropriate single or double precision version to be used.
4c0581c19SLois Curfman McInnes This file also deals with different Fortran 77 naming conventions on machines.
55392566eSBarry Smith 
6217f3c9bSSatish Balay    Another problem is character strings are represented differently on
75392566eSBarry Smith on some machines in C and Fortran 77. This problem comes up on the
8633a50d3SSatish Balay Cray T3D/T3E.
95392566eSBarry Smith 
10a1e12872SBarry Smith */
11c3e41550SBarry Smith #if !defined(_BLASLAPACK_H)
12c3e41550SBarry Smith #define _BLASLAPACK_H
1319b02663SBarry Smith #include "petsc.h"
14e9fa29b7SSatish Balay PETSC_EXTERN_CXX_BEGIN
15bb638ab5SSatish Balay 
168e0e00b1SSatish Balay #if defined(PETSC_BLASLAPACK_MKL64_ONLY)
178e0e00b1SSatish Balay #define PETSC_MISSING_LAPACK_GESVD
188e0e00b1SSatish Balay #define PETSC_MISSING_LAPACK_GEEV
198e0e00b1SSatish Balay #define PETSC_MISSING_LAPACK_GETRF
208e0e00b1SSatish Balay #define PETSC_MISSING_LAPACK_POTRF
218e0e00b1SSatish Balay #define PETSC_MISSING_LAPACK_GETRS
228e0e00b1SSatish Balay #define PETSC_MISSING_LAPACK_POTRS
23e7906763SSatish Balay #elif defined(PETSC_BLASLAPACK_MKL_ONLY)
24bb638ab5SSatish Balay #define PETSC_MISSING_LAPACK_GESVD
25bb638ab5SSatish Balay #define PETSC_MISSING_LAPACK_GEEV
26ae7cfcebSSatish Balay #elif defined(PETSC_BLASLAPACK_CRAY_ONLY)
27bb638ab5SSatish Balay #define PETSC_MISSING_LAPACK_GESVD
28ae7cfcebSSatish Balay #elif defined(PETSC_BLASLAPACK_ESSL_ONLY)
29e3353558SSatish Balay #define PETSC_MISSING_LAPACK_GESVD
30ae7cfcebSSatish Balay #define PETSC_MISSING_LAPACK_GETRF
31ae7cfcebSSatish Balay #define PETSC_MISSING_LAPACK_GETRS
32ae7cfcebSSatish Balay #define PETSC_MISSING_LAPACK_POTRF
33ae7cfcebSSatish Balay #define PETSC_MISSING_LAPACK_POTRS
34bb638ab5SSatish Balay #endif
35bb638ab5SSatish Balay 
368f4c8dbaSBarry Smith /*
37633a50d3SSatish Balay    This include file on the Cray T3D/T3E defines the interface between
38217f3c9bSSatish Balay   Fortran and C representations of character strings.
398f4c8dbaSBarry Smith */
40f1af5d2fSBarry Smith #if defined(PETSC_USES_CPTOFCD)
4193c39befSBarry Smith #include <fortran.h>
425392566eSBarry Smith #endif
435392566eSBarry Smith 
44aa482453SBarry Smith #if !defined(PETSC_USE_COMPLEX)
454eeb42bcSBarry Smith 
464eeb42bcSBarry Smith /*
474eeb42bcSBarry Smith     These are real case with no character string arguments
484eeb42bcSBarry Smith */
498f4c8dbaSBarry Smith 
50f1af5d2fSBarry Smith #if defined(PETSC_USES_FORTRAN_SINGLE)
518f4c8dbaSBarry Smith /*
528f4c8dbaSBarry Smith    For these machines we must call the single precision Fortran version
538f4c8dbaSBarry Smith */
548f4c8dbaSBarry Smith #define DGEQRF   SGEQRF
558f4c8dbaSBarry Smith #define DGETRF   SGETRF
568f4c8dbaSBarry Smith #define DDOT     SDOT
578f4c8dbaSBarry Smith #define DNRM2    SNRM2
588f4c8dbaSBarry Smith #define DSCAL    SSCAL
598f4c8dbaSBarry Smith #define DCOPY    SCOPY
608f4c8dbaSBarry Smith #define DSWAP    SSWAP
618f4c8dbaSBarry Smith #define DAXPY    SAXPY
628f4c8dbaSBarry Smith #define DASUM    SASUM
638f4c8dbaSBarry Smith #define DSORMQR  SORMQR
648f4c8dbaSBarry Smith #define DTRTRS   STRTRS
658f4c8dbaSBarry Smith #define DPOTRF   SPOTRF
668f4c8dbaSBarry Smith #define DPOTRS   SPOTRS
678f4c8dbaSBarry Smith #define DGEMV    SGEMV
688f4c8dbaSBarry Smith #define DGETRS   SGETRS
698f4c8dbaSBarry Smith #define DGETRS   SGETRS
708f4c8dbaSBarry Smith #define DGEMM    SGEMM
718f4c8dbaSBarry Smith #define DGESVD   SGESVD
72d4fbbf0eSBarry Smith #define DGEEV    SGEEV
738f4c8dbaSBarry Smith #define DTRMV    STRMV
748f4c8dbaSBarry Smith #define DTRSL    STRSL
758f4c8dbaSBarry Smith #endif
768f4c8dbaSBarry Smith 
7701ad1a64SSatish Balay #if defined(PETSC_USE_SINGLE)
7801ad1a64SSatish Balay 
7901ad1a64SSatish Balay #if defined(PETSC_HAVE_FORTRAN_UNDERSCORE) || defined(PETSC_BLASLAPACK_F2C)
8001ad1a64SSatish Balay #define LAgeqrf_ sgeqrf_
8101ad1a64SSatish Balay #define LAgetrf_ sgetrf_
8201ad1a64SSatish Balay #define LAgetf2_ sgetf2_
8301ad1a64SSatish Balay #define BLdot_   sdot_
8401ad1a64SSatish Balay #define BLnrm2_  snrm2_
8501ad1a64SSatish Balay #define BLscal_  sscal_
8601ad1a64SSatish Balay #define BLcopy_  scopy_
8701ad1a64SSatish Balay #define BLswap_  sswap_
8801ad1a64SSatish Balay #define BLaxpy_  saxpy_
8901ad1a64SSatish Balay #define BLasum_  sasum_
9001ad1a64SSatish Balay #elif defined(PETSC_HAVE_FORTRAN_CAPS)
9101ad1a64SSatish Balay #define LAgeqrf_ SGEQRF
9201ad1a64SSatish Balay #define LAgetrf_ SGETRF
9301ad1a64SSatish Balay #define LAgetf2_ SGETF2
9401ad1a64SSatish Balay #define BLdot_   SDOT
9501ad1a64SSatish Balay #define BLnrm2_  SNRM2
9601ad1a64SSatish Balay #define BLscal_  SSCAL
9701ad1a64SSatish Balay #define BLcopy_  SCOPY
9801ad1a64SSatish Balay #define BLswap_  SSWAP
9901ad1a64SSatish Balay #define BLaxpy_  SAXPY
10001ad1a64SSatish Balay #define BLasum_  SASUM
10101ad1a64SSatish Balay #else
10201ad1a64SSatish Balay #define LAgeqrf_ sgeqrf
10301ad1a64SSatish Balay #define LAgetrf_ sgetrf
10401ad1a64SSatish Balay #define LAgetf2_ sgetf2
10501ad1a64SSatish Balay #define BLdot_   sdot
10601ad1a64SSatish Balay #define BLnrm2_  snrm2
10701ad1a64SSatish Balay #define BLscal_  sscal
10801ad1a64SSatish Balay #define BLcopy_  scopy
10901ad1a64SSatish Balay #define BLswap_  sswap
11001ad1a64SSatish Balay #define BLaxpy_  saxpy
11101ad1a64SSatish Balay #define BLasum_  sasum
11201ad1a64SSatish Balay #endif
11301ad1a64SSatish Balay 
11401ad1a64SSatish Balay #else
11501ad1a64SSatish Balay 
116ae7cfcebSSatish Balay #if defined(PETSC_HAVE_FORTRAN_UNDERSCORE) || defined(PETSC_BLASLAPACK_F2C)
117c0534c1cSBarry Smith #define LAgeqrf_ dgeqrf_
1185392566eSBarry Smith #define LAgetrf_ dgetrf_
119c0581c19SLois Curfman McInnes #define LAgetf2_ dgetf2_
120a1e12872SBarry Smith #define BLdot_   ddot_
121a1e12872SBarry Smith #define BLnrm2_  dnrm2_
122a1e12872SBarry Smith #define BLscal_  dscal_
123a1e12872SBarry Smith #define BLcopy_  dcopy_
124a1e12872SBarry Smith #define BLswap_  dswap_
125a1e12872SBarry Smith #define BLaxpy_  daxpy_
126a1e12872SBarry Smith #define BLasum_  dasum_
127aa482453SBarry Smith #elif defined(PETSC_HAVE_FORTRAN_CAPS)
12825fce39dSBarry Smith #define LAgeqrf_ DGEQRF
12925fce39dSBarry Smith #define LAgetrf_ DGETRF
13025fce39dSBarry Smith #define LAgetf2_ DGETF2
13125fce39dSBarry Smith #define BLdot_   DDOT
13225fce39dSBarry Smith #define BLnrm2_  DNRM2
13325fce39dSBarry Smith #define BLscal_  DSCAL
13425fce39dSBarry Smith #define BLcopy_  DCOPY
13525fce39dSBarry Smith #define BLswap_  DSWAP
13625fce39dSBarry Smith #define BLaxpy_  DAXPY
13725fce39dSBarry Smith #define BLasum_  DASUM
13825fce39dSBarry Smith #else
13925fce39dSBarry Smith #define LAgeqrf_ dgeqrf
14025fce39dSBarry Smith #define LAgetrf_ dgetrf
14125fce39dSBarry Smith #define LAgetf2_ dgetf2
14225fce39dSBarry Smith #define BLdot_   ddot
14325fce39dSBarry Smith #define BLnrm2_  dnrm2
14425fce39dSBarry Smith #define BLscal_  dscal
14525fce39dSBarry Smith #define BLcopy_  dcopy
14625fce39dSBarry Smith #define BLswap_  dswap
14725fce39dSBarry Smith #define BLaxpy_  daxpy
14825fce39dSBarry Smith #define BLasum_  dasum
149a1e12872SBarry Smith #endif
150a1e12872SBarry Smith 
15101ad1a64SSatish Balay #endif
15201ad1a64SSatish Balay 
1534eeb42bcSBarry Smith /*
1544eeb42bcSBarry Smith    Real with character string arguments.
1554eeb42bcSBarry Smith */
156f1af5d2fSBarry Smith #if defined(PETSC_USES_CPTOFCD)
1578f4c8dbaSBarry Smith /*
1588f4c8dbaSBarry Smith    Note that this assumes that machines which use cptofcd() use
159aa482453SBarry Smith   the PETSC_HAVE_FORTRAN_CAPS option. This is true on the Cray T3D/T3E.
1608f4c8dbaSBarry Smith */
161f7d3a2fdSBarry Smith #define LAormqr_(a,b,c,d,e,f,g,h,i,j,k,l,m)   DORMQR(_cptofcd((a),1),_cptofcd((b),1),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m))
162f7d3a2fdSBarry Smith #define LAtrtrs_(a,b,c,d,e,f,g,h,i,j)         DTRTRS(_cptofcd((a),1),_cptofcd((b),1),_cptofcd((c),1),(d),(e),(f),(g),(h),(i),(j))
1638f4c8dbaSBarry Smith #define LApotrf_(a,b,c,d,e)                   DPOTRF(_cptofcd((a),1),(b),(c),(d),(e))
164f7d3a2fdSBarry Smith #define LApotrs_(a,b,c,d,e,f,g,h)             DPOTRS(_cptofcd((a),1),(b),(c),(d),(e),(f),(g),(h))
165f7d3a2fdSBarry Smith #define LAgemv_(a,b,c,d,e,f,g,h,i,j,k)        DGEMV(_cptofcd((a),1),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k))
166f7d3a2fdSBarry Smith #define LAgetrs_(a,b,c,d,e,f,g,h,i)           DGETRS(_cptofcd((a),1),(b),(c),(d),(e),(f),(g),(h),(i))
167f7d3a2fdSBarry Smith #define LAgetrs_(a,b,c,d,e,f,g,h,i)           DGETRS(_cptofcd((a),1),(b),(c),(d),(e),(f),(g),(h),(i))
168f7d3a2fdSBarry Smith #define BLgemm_(a,b,c,d,e,f,g,h,i,j,k,l,m)    DGEMM(_cptofcd((a),1), _cptofcd((a),1),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m))
169f7d3a2fdSBarry Smith #define LAgesvd_(a,b,c,d,e,f,g,h,i,j,k,l,m,n) DGESVD(_cptofcd((a),1),_cptofcd((a),1),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n))
170f7d3a2fdSBarry Smith #define LAgeev_(a,b,c,d,e,f,g,h,i,j,k,l,m,n)  DGEEV(_cptofcd((a),1),_cptofcd((a),1),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n))
1718f4c8dbaSBarry Smith #define LAtrmv_  DTRMV
1728f4c8dbaSBarry Smith #define LAtrsl_  DTRSL
173633a50d3SSatish Balay #define LAgetrf_ DGETRF
174516d1546SSatish Balay 
175516d1546SSatish Balay #elif defined(PETSC_USE_SINGLE)
176516d1546SSatish Balay 
177516d1546SSatish Balay #if defined(PETSC_HAVE_FORTRAN_UNDERSCORE) || defined(PETSC_BLASLAPACK_F2C)
178516d1546SSatish Balay #define LAormqr_ sormqr_
179516d1546SSatish Balay #define LAtrtrs_ strtrs_
180516d1546SSatish Balay #define LApotrf_ spotrf_
181516d1546SSatish Balay #define LApotrs_ spotrs_
182516d1546SSatish Balay #define LAgemv_  sgemv_
183516d1546SSatish Balay #define LAgetrs_ sgetrs_
184516d1546SSatish Balay #define LAtrmv_  strmv_
185516d1546SSatish Balay #define LAtrsl_  strsl_
186516d1546SSatish Balay #define BLgemm_  sgemm_
187516d1546SSatish Balay #define LAgesvd_ sgesvd_
188516d1546SSatish Balay #define LAgeev_  sgeev_
189516d1546SSatish Balay #elif defined(PETSC_HAVE_FORTRAN_CAPS)
190516d1546SSatish Balay #define LAormqr_ SORMQR
191516d1546SSatish Balay #define LAtrtrs_ STRTRS
192516d1546SSatish Balay #define LApotrf_ SPOTRF
193516d1546SSatish Balay #define LApotrs_ SPOTRS
194516d1546SSatish Balay #define LAgemv_  SGEMV
195516d1546SSatish Balay #define LAgetrs_ SGETRS
196516d1546SSatish Balay #define LAtrmv_  STRMV
197516d1546SSatish Balay #define LAtrsl_  STRSL
198516d1546SSatish Balay #define LAgesvd_ SGESVD
199516d1546SSatish Balay #define LAgeev_  SGEEV
200516d1546SSatish Balay #define BLgemm_  SGEMM
201516d1546SSatish Balay #else
202516d1546SSatish Balay #define LAormqr_ sormqr
203516d1546SSatish Balay #define LAtrtrs_ strtrs
204516d1546SSatish Balay #define LApotrf_ spotrf
205516d1546SSatish Balay #define LApotrs_ spotrs
206516d1546SSatish Balay #define LAgemv_  sgemv
207516d1546SSatish Balay #define LAgetrs_ sgetrs
208516d1546SSatish Balay #define LAtrmv_  strmv
209516d1546SSatish Balay #define LAtrsl_  strsl
210516d1546SSatish Balay #define BLgemm_  sgemm
211516d1546SSatish Balay #define LAgesvd_ sgesvd
212516d1546SSatish Balay #define LAgeev_  sgeev
213516d1546SSatish Balay #endif
214516d1546SSatish Balay 
215516d1546SSatish Balay #else /* PETSC_USE_SINGLE */
216516d1546SSatish Balay 
217516d1546SSatish Balay #if defined(PETSC_HAVE_FORTRAN_UNDERSCORE) || defined(PETSC_BLASLAPACK_F2C)
21825fce39dSBarry Smith #define LAormqr_ dormqr_
21925fce39dSBarry Smith #define LAtrtrs_ dtrtrs_
22025fce39dSBarry Smith #define LApotrf_ dpotrf_
22125fce39dSBarry Smith #define LApotrs_ dpotrs_
22225fce39dSBarry Smith #define LAgemv_  dgemv_
22325fce39dSBarry Smith #define LAgetrs_ dgetrs_
22425fce39dSBarry Smith #define LAtrmv_  dtrmv_
22525fce39dSBarry Smith #define LAtrsl_  dtrsl_
22625fce39dSBarry Smith #define BLgemm_  dgemm_
22725fce39dSBarry Smith #define LAgesvd_ dgesvd_
22825fce39dSBarry Smith #define LAgeev_  dgeev_
229aa482453SBarry Smith #elif defined(PETSC_HAVE_FORTRAN_CAPS)
230c0534c1cSBarry Smith #define LAormqr_ DORMQR
231c0534c1cSBarry Smith #define LAtrtrs_ DTRTRS
232a1e12872SBarry Smith #define LApotrf_ DPOTRF
233a1e12872SBarry Smith #define LApotrs_ DPOTRS
234a1e12872SBarry Smith #define LAgemv_  DGEMV
235a1e12872SBarry Smith #define LAgetrs_ DGETRS
236a1e12872SBarry Smith #define LAtrmv_  DTRMV
237a1e12872SBarry Smith #define LAtrsl_  DTRSL
238af6b99e9SBarry Smith #define LAgesvd_ DGESVD
239d4fbbf0eSBarry Smith #define LAgeev_  DGEEV
2404eeb42bcSBarry Smith #define BLgemm_  DGEMM
24125fce39dSBarry Smith #else
242c0534c1cSBarry Smith #define LAormqr_ dormqr
243c0534c1cSBarry Smith #define LAtrtrs_ dtrtrs
244a1e12872SBarry Smith #define LApotrf_ dpotrf
245a1e12872SBarry Smith #define LApotrs_ dpotrs
246a1e12872SBarry Smith #define LAgemv_  dgemv
247a1e12872SBarry Smith #define LAgetrs_ dgetrs
248a1e12872SBarry Smith #define LAtrmv_  dtrmv
249a1e12872SBarry Smith #define LAtrsl_  dtrsl
2504eeb42bcSBarry Smith #define BLgemm_  dgemm
251af6b99e9SBarry Smith #define LAgesvd_ dgesvd
252d4fbbf0eSBarry Smith #define LAgeev_  dgeev
253a1e12872SBarry Smith #endif
254a1e12872SBarry Smith 
255516d1546SSatish Balay #endif /* PETSC_USES_CPTOFCD */
256516d1546SSatish Balay 
257a1e12872SBarry Smith #else
2584eeb42bcSBarry Smith /*
2594eeb42bcSBarry Smith    Complex with no character string arguments
2604eeb42bcSBarry Smith */
261f1af5d2fSBarry Smith #if defined(PETSC_USES_FORTRAN_SINGLE)
2628f4c8dbaSBarry Smith #define ZGEQRF  CGEQRF
2638f4c8dbaSBarry Smith #define ZDOTC   CDOTC
2648f4c8dbaSBarry Smith #define DZNRM2  SCNRM2
2658f4c8dbaSBarry Smith #define ZSCAL   CSCAL
2668f4c8dbaSBarry Smith #define ZCOPY   CCOPY
2678f4c8dbaSBarry Smith #define ZSWAP   CSWAP
2688f4c8dbaSBarry Smith #define ZAXPY   CAXPY
2698f4c8dbaSBarry Smith #define DZASUM  SCASUM
2708f4c8dbaSBarry Smith #define ZGETRF  CGETRF
2718f4c8dbaSBarry Smith #define ZTRTRS  CTRTRS
2728f4c8dbaSBarry Smith #define ZPOTRF  CPOTRF
2738f4c8dbaSBarry Smith #define ZPOTRS  CPOTRS
2748f4c8dbaSBarry Smith #define ZGEMV   CGEMV
2758f4c8dbaSBarry Smith #define ZGETRS  CGETRS
2768f4c8dbaSBarry Smith #define ZGEMM   SGEMM
2778f4c8dbaSBarry Smith #define ZTRMV   CTRMV
278160814fdSSatish Balay #define ZTRSL   CTRSL
279633a50d3SSatish Balay #define ZGEEV   CGEEV
2808f4c8dbaSBarry Smith #endif
2818f4c8dbaSBarry Smith 
282ae7cfcebSSatish Balay #if defined(PETSC_HAVE_FORTRAN_UNDERSCORE) || defined(PETSC_BLASLAPACK_F2C)
283c0534c1cSBarry Smith #define LAgeqrf_ zgeqrf_
2845392566eSBarry Smith #define LAgetrf_ zgetrf_
28508d0dac7SLois Curfman McInnes #define LAgetf2_ zgetf2_
286a1e12872SBarry Smith #define BLdot_   zdotc_
287a1e12872SBarry Smith #define BLnrm2_  dznrm2_
288a1e12872SBarry Smith #define BLscal_  zscal_
289a1e12872SBarry Smith #define BLcopy_  zcopy_
290a1e12872SBarry Smith #define BLswap_  zswap_
291a1e12872SBarry Smith #define BLaxpy_  zaxpy_
292a1e12872SBarry Smith #define BLasum_  dzasum_
293aa482453SBarry Smith #elif defined(PETSC_HAVE_FORTRAN_CAPS)
29425fce39dSBarry Smith #define LAgeqrf_ ZGEQRF
29525fce39dSBarry Smith #define BLdot_   ZDOTC
29625fce39dSBarry Smith #define BLnrm2_  DZNRM2
29725fce39dSBarry Smith #define BLscal_  ZSCAL
29825fce39dSBarry Smith #define BLcopy_  ZCOPY
29925fce39dSBarry Smith #define BLswap_  ZSWAP
30025fce39dSBarry Smith #define BLaxpy_  ZAXPY
30125fce39dSBarry Smith #define BLasum_  DZASUM
30225fce39dSBarry Smith #define LAgetrf_ ZGETRF
30325fce39dSBarry Smith #else
30425fce39dSBarry Smith #define LAgeqrf_ zgeqrf
30525fce39dSBarry Smith #define LAgetrf_ zgetrf
30625fce39dSBarry Smith #define LAgetf2_ zgetf2
30725fce39dSBarry Smith #define BLdot_   zdotc
30825fce39dSBarry Smith #define BLnrm2_  dznrm2
30925fce39dSBarry Smith #define BLscal_  zscal
31025fce39dSBarry Smith #define BLcopy_  zcopy
31125fce39dSBarry Smith #define BLswap_  zswap
31225fce39dSBarry Smith #define BLaxpy_  zaxpy
31325fce39dSBarry Smith #define BLasum_  dzasum
314a1e12872SBarry Smith #endif
315a1e12872SBarry Smith 
316f1af5d2fSBarry Smith #if defined(PETSC_USES_CPTOFCD)
317f7d3a2fdSBarry Smith #define LAtrtrs_(a,b,c,d,e,f,g,h,i,j)           ZTRTRS(_cptofcd((a),1),_cptofcd((b),1),_cptofcd((c),1),(d),(e),(f),(g),(h),(i),(j))
3188f4c8dbaSBarry Smith #define LApotrf_(a,b,c,d,e)                     ZPOTRF(_cptofcd((a),1),(b),(c),(d),(e))
319f7d3a2fdSBarry Smith #define LApotrs_(a,b,c,d,e,f,g,h)               ZPOTRS(_cptofcd((a),1),(b),(c),(d),(e),(f),(g),(h))
320f7d3a2fdSBarry Smith #define LAgemv_(a,b,c,d,e,f,g,h,i,j,k)          ZGEMV(_cptofcd((a),1),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k))
321f7d3a2fdSBarry Smith #define LAgetrs_(a,b,c,d,e,f,g,h,i)             ZGETRS(_cptofcd((a),1),(b),(c),(d),(e),(f),(g),(h),(i))
322f7d3a2fdSBarry Smith #define BLgemm_(a,b,c,d,e,f,g,h,i,j,k,l,m)      ZGEMM(_cptofcd((a),1),_cptofcd((a),1),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m))
323f7d3a2fdSBarry Smith #define LAgesvd_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,p) ZGESVD(_cptofcd((a),1),_cptofcd((a),1),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(p))
324f7d3a2fdSBarry Smith #define LAgeev_(a,b,c,d,e,f,g,h,i,j,k,l,m,n)    ZGEEV(_cptofcd((a),1),_cptofcd((a),1),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n))
3258f4c8dbaSBarry Smith #define LAtrmv_  ZTRMV
3268f4c8dbaSBarry Smith #define LAtrsl_  ZTRSL
327ae7cfcebSSatish Balay #elif defined(PETSC_HAVE_FORTRAN_UNDERSCORE) || defined(PETSC_BLASLAPACK_F2C)
32825fce39dSBarry Smith #define LAtrtrs_ ztrtrs_
32925fce39dSBarry Smith #define LApotrf_ zpotrf_
33025fce39dSBarry Smith #define LApotrs_ zpotrs_
33125fce39dSBarry Smith #define LAgemv_  zgemv_
33225fce39dSBarry Smith #define LAgetrs_ zgetrs_
33325fce39dSBarry Smith #define LAtrmv_  ztrmv_
33425fce39dSBarry Smith #define LAtrsl_  ztrsl_
33525fce39dSBarry Smith #define BLgemm_  zgemm_
33625fce39dSBarry Smith #define LAgesvd_ zgesvd_
33725fce39dSBarry Smith #define LAgeev_  zgeev_
338aa482453SBarry Smith #elif defined(PETSC_HAVE_FORTRAN_CAPS)
339c0534c1cSBarry Smith #define LAtrtrs_ ZTRTRS
340a1e12872SBarry Smith #define LApotrf_ ZPOTRF
341a1e12872SBarry Smith #define LApotrs_ ZPOTRS
342a1e12872SBarry Smith #define LAgemv_  ZGEMV
343a1e12872SBarry Smith #define LAgetrf_ ZGETRF
34408d0dac7SLois Curfman McInnes #define LAgetf2_ ZGETF2
345a1e12872SBarry Smith #define LAgetrs_ ZGETRS
346a1e12872SBarry Smith #define LAtrmv_  ZTRMV
347a1e12872SBarry Smith #define LAtrsl_  ZTRSL
3485a778de9SBarry Smith #define BLgemm_  ZGEMM
349d4fbbf0eSBarry Smith #define LAgesvd_ ZGESVD
350d4fbbf0eSBarry Smith #define LAgeev_  ZGEEV
35125fce39dSBarry Smith #else
352c0534c1cSBarry Smith #define LAtrtrs_ ztrtrs
353a1e12872SBarry Smith #define LApotrf_ zpotrf
354a1e12872SBarry Smith #define LApotrs_ zpotrs
355a1e12872SBarry Smith #define LAgemv_  zgemv
356a1e12872SBarry Smith #define LAgetrs_ zgetrs
357a1e12872SBarry Smith #define LAtrmv_  ztrmv
358a1e12872SBarry Smith #define LAtrsl_  ztrsl
3595a778de9SBarry Smith #define BLgemm_  zgemm
360d4fbbf0eSBarry Smith #define LAgesvd_ zgesvd
361d4fbbf0eSBarry Smith #define LAgeev_  zgeev
362a1e12872SBarry Smith #endif
363a1e12872SBarry Smith 
364a1e12872SBarry Smith #endif
365a1e12872SBarry Smith 
366fb2e594dSBarry Smith EXTERN_C_BEGIN
367a1e12872SBarry Smith 
3688f4c8dbaSBarry Smith /*
3698f4c8dbaSBarry Smith    BLdot cannot be used with COMPLEX because it cannot
3708f4c8dbaSBarry Smith    handle returing a double complex to C++.
371126c565eSBarry Smith */
372*4ce68768SBarry Smith EXTERN PetscReal BLdot_(PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*);
373*4ce68768SBarry Smith EXTERN PetscReal BLnrm2_(PetscBLASInt*,PetscScalar*,PetscBLASInt*);
374*4ce68768SBarry Smith EXTERN PetscReal BLasum_(PetscBLASInt*,PetscScalar*,PetscBLASInt*);
375*4ce68768SBarry Smith EXTERN void      BLscal_(PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*);
376*4ce68768SBarry Smith EXTERN void      BLcopy_(PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*);
377*4ce68768SBarry Smith EXTERN void      BLswap_(PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*);
378*4ce68768SBarry Smith EXTERN void      BLaxpy_(PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*);
379*4ce68768SBarry Smith EXTERN void      LAgetrf_(PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
380*4ce68768SBarry Smith EXTERN void      LAgetf2_(PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
381*4ce68768SBarry Smith EXTERN void      LAgeqrf_(PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
3825392566eSBarry Smith 
383f1af5d2fSBarry Smith #if defined(PETSC_USES_CPTOFCD)
384112a2221SBarry Smith 
385aa482453SBarry Smith #if defined(PETSC_USE_COMPLEX)
386*4ce68768SBarry Smith EXTERN void   ZORMQR(_fcd,_fcd,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
387*4ce68768SBarry Smith EXTERN void   ZTRTRS(_fcd,_fcd,_fcd,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
388*4ce68768SBarry Smith EXTERN void   ZPOTRF(_fcd,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
389*4ce68768SBarry Smith EXTERN void   ZGEMV(_fcd,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar *,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*);
390*4ce68768SBarry Smith EXTERN void   ZPOTRS(_fcd,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
391*4ce68768SBarry Smith EXTERN void   ZGETRS(_fcd,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
392*4ce68768SBarry Smith EXTERN void   ZGEMM(_fcd,_fcd,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*);
393*4ce68768SBarry Smith EXTERN void   ZGESVD(_fcd,_fcd,PetscBLASInt *,PetscBLASInt*,PetscScalar *,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*);
394*4ce68768SBarry Smith EXTERN void   ZGEEV(_fcd,_fcd,PetscBLASInt *,PetscScalar *,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*);
3955392566eSBarry Smith #else
396*4ce68768SBarry Smith EXTERN void   DORMQR(_fcd,_fcd,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
397*4ce68768SBarry Smith EXTERN void   DTRTRS(_fcd,_fcd,_fcd,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
398*4ce68768SBarry Smith EXTERN void   DPOTRF(_fcd,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
399*4ce68768SBarry Smith EXTERN void   DGEMV(_fcd,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar *,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*);
400*4ce68768SBarry Smith EXTERN void   DPOTRS(_fcd,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
401*4ce68768SBarry Smith EXTERN void   DGETRS(_fcd,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
402*4ce68768SBarry Smith EXTERN void   DGEMM(_fcd,_fcd,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*);
403*4ce68768SBarry Smith EXTERN void   DGESVD(_fcd,_fcd,PetscBLASInt *,PetscBLASInt*,PetscScalar *,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
404*4ce68768SBarry Smith EXTERN void   DGEEV(_fcd,_fcd,PetscBLASInt *,PetscScalar *,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
405112a2221SBarry Smith #endif
406112a2221SBarry Smith 
407112a2221SBarry Smith #else
408*4ce68768SBarry Smith EXTERN void   LAormqr_(const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
409*4ce68768SBarry Smith EXTERN void   LAtrtrs_(const char*,const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
410*4ce68768SBarry Smith EXTERN void   LApotrf_(const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
411*4ce68768SBarry Smith EXTERN void   LAgemv_(const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar *,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*);
412*4ce68768SBarry Smith EXTERN void   LApotrs_(const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
413*4ce68768SBarry Smith EXTERN void   LAgetrs_(const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
414*4ce68768SBarry Smith EXTERN void   BLgemm_(const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*);
415e38aa075SLois Curfman McInnes 
416e38aa075SLois Curfman McInnes /* ESSL uses a different calling sequence for dgeev(), zgeev() than LAPACK; */
417aa482453SBarry Smith #if defined(PETSC_HAVE_ESSL) && defined(PETSC_USE_COMPLEX)
418*4ce68768SBarry Smith EXTERN void   LAgeev_(PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscBLASInt*);
419*4ce68768SBarry Smith EXTERN void   LAgesvd_(const char*,const char*,PetscBLASInt *,PetscBLASInt*,PetscScalar *,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*);
420aa482453SBarry Smith #elif defined(PETSC_HAVE_ESSL)
421*4ce68768SBarry Smith EXTERN void   LAgeev_(PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscBLASInt*);
422*4ce68768SBarry Smith EXTERN void   LAgesvd_(const char*,const char*,PetscBLASInt *,PetscBLASInt*,PetscScalar *,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
423aa482453SBarry Smith #elif !defined(PETSC_USE_COMPLEX)
424*4ce68768SBarry Smith EXTERN void   LAgeev_(const char*,const char*,PetscBLASInt *,PetscScalar *,PetscBLASInt*,PetscReal*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
425*4ce68768SBarry Smith EXTERN void   LAgesvd_(const char*,const char*,PetscBLASInt *,PetscBLASInt*,PetscScalar *,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
426d4fbbf0eSBarry Smith #else
427*4ce68768SBarry Smith EXTERN void   LAgeev_(const char*,const char*,PetscBLASInt *,PetscScalar *,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*);
428*4ce68768SBarry Smith EXTERN void   LAgesvd_(const char*,const char*,PetscBLASInt *,PetscBLASInt*,PetscScalar *,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*);
429d4fbbf0eSBarry Smith #endif
4305392566eSBarry Smith #endif
431a1e12872SBarry Smith 
432fb2e594dSBarry Smith EXTERN_C_END
433e9fa29b7SSatish Balay PETSC_EXTERN_CXX_END
434a1e12872SBarry Smith #endif
435