xref: /petsc/include/petscblaslapack.h (revision 04443170c0e5dc50d0ce8ac28a2f575179d3e1d2)
1 /* $Id: plapack.h,v 1.4 1995/06/14 17:25:19 bsmith Exp bsmith $ */
2 /*
3    This is to provide some name space protection from Lapack and Blas
4 allow the appropriate single or double precision version to be used.
5 Also deals with different Fortran 77 naming conventions on machines.
6 
7    Another problem is charactor strings are represented differently on
8 on some machines in C and Fortran 77. This problem comes up on the
9 Cray T3D. Yet another reason to hate ...
10 
11 */
12 #if !defined(_PLAPACK_H)
13 #define _PLAPACK_H
14 
15 #include "ptscimpl.h"
16 
17 #if defined(PARCH_t3d)
18 #include "fortran.h"
19 #endif
20 
21 
22 #if !defined(PETSC_COMPLEX)
23 #if defined(PARCH_cray) || defined(PARCH_t3d)
24 #define LAgetrf_ SGETRF
25 #define BLdot_   SDOT
26 #define BLnrm2_  SNRM2
27 #define BLscal_  SSCAL
28 #define BLcopy_  SCOPY
29 #define BLswap_  SSWAP
30 #define BLaxpy_  SAXPY
31 #define BLasum_  SASUM
32 #elif defined(FORTRANCAPS)
33 #define LAgetrf_ DGETRF
34 #define BLdot_   DDOT
35 #define BLnrm2_  DNRM2
36 #define BLscal_  DSCAL
37 #define BLcopy_  DCOPY
38 #define BLswap_  DSWAP
39 #define BLaxpy_  DAXPY
40 #define BLasum_  DASUM
41 #elif !defined(FORTRANUNDERSCORE)
42 #define LAgetrf_ dgetrf
43 #define BLdot_   ddot
44 #define BLnrm2_  dnrm2
45 #define BLscal_  dscal
46 #define BLcopy_  dcopy
47 #define BLswap_  dswap
48 #define BLaxpy_  daxpy
49 #define BLasum_  dasum
50 #else
51 #define LAgetrf_ dgetrf_
52 #define BLdot_   ddot_
53 #define BLnrm2_  dnrm2_
54 #define BLscal_  dscal_
55 #define BLcopy_  dcopy_
56 #define BLswap_  dswap_
57 #define BLaxpy_  daxpy_
58 #define BLasum_  dasum_
59 #endif
60 
61 #if defined(PARCH_t3d)
62 #define LApotrf_(a,b,c,d,e) SPOTRF(_cptofcd((a),1),(b),(c),(d),(e))
63 #define LApotrs_(a,b,c,d,e,f,g,h) SPOTRS(_cptofcd((a),1),(b),(c),(d),(e),\
64                                          (f),(g),(h))
65 #define LAgemv_(a,b,c,d,e,f,g,h,i,j,k) SGEMV(_cptofcd((a),1),(b),(c),(d),(e),\
66                                         (f),(g),(h),(i),(j),(k))
67 #define LAgetrs_(a,b,c,d,e,f,g,h,i) SGETRS(_cptofcd((a),1),(b),(c),(d),(e),\
68                                         (f),(g),(h),(i))
69 #define LAtrmv_  STRMV
70 #define LAtrsl_  STRSL
71 #elif defined(PARCH_cray)
72 #define LApotrf_ SPOTRF
73 #define LApotrs_ SPOTRS
74 #define LAgemv_  SGEMV
75 #define LAgetrs_ SGETRS
76 #define LAgemv_  SGEMV
77 #define LAtrmv_  STRMV
78 #define LAtrsl_  STRSL
79 #elif defined(FORTRANCAPS)
80 #define LApotrf_ DPOTRF
81 #define LApotrs_ DPOTRS
82 #define LAgemv_  DGEMV
83 #define LAgetrs_ DGETRS
84 #define LAtrmv_  DTRMV
85 #define LAtrsl_  DTRSL
86 #elif !defined(FORTRANUNDERSCORE)
87 #define LApotrf_ dpotrf
88 #define LApotrs_ dpotrs
89 #define LAgemv_  dgemv
90 #define LAgetrs_ dgetrs
91 #define LAtrmv_  dtrmv
92 #define LAtrsl_  dtrsl
93 #else
94 #define LApotrf_ dpotrf_
95 #define LApotrs_ dpotrs_
96 #define LAgemv_  dgemv_
97 #define LAgetrs_ dgetrs_
98 #define LAtrmv_  dtrmv_
99 #define LAtrsl_  dtrsl_
100 #endif
101 
102 #else
103 
104 #if defined(PARCH_cray) || defined(PARCH_t3d)
105 #define BLdot_   CDOTC
106 #define BLnrm2_  SCNRM2
107 #define BLscal_  CSCAL
108 #define BLcopy_  CCOPY
109 #define BLswap_  CSWAP
110 #define BLaxpy_  CAXPY
111 #define BLasum_  SCASUM
112 #define LAgetrf_ CGETRF
113 #elif defined(FORTRANCAPS)
114 #define BLdot_   ZDOTC
115 #define BLnrm2_  DZNRM2
116 #define BLscal_  ZSCAL
117 #define BLcopy_  ZCOPY
118 #define BLswap_  ZSWAP
119 #define BLaxpy_  ZAXPY
120 #define BLasum_  DZASUM
121 #elif !defined(FORTRANUNDERSCORE)
122 #define LAgetrf_ zgetrf
123 #define BLdot_   zdotc
124 #define BLnrm2_  dznrm2
125 #define BLscal_  zscal
126 #define BLcopy_  zcopy
127 #define BLswap_  zswap
128 #define BLaxpy_  zaxpy
129 #define BLasum_  dzasum
130 #else
131 #define LAgetrf_ zgetrf_
132 #define BLdot_   zdotc_
133 #define BLnrm2_  dznrm2_
134 #define BLscal_  zscal_
135 #define BLcopy_  zcopy_
136 #define BLswap_  zswap_
137 #define BLaxpy_  zaxpy_
138 #define BLasum_  dzasum_
139 #endif
140 
141 #if defined(PARCH_t3d)
142 #define LApotrf_(a,b,c,d,e)       CPOTRF(_cptofcd((a),1),(b),(c),(d),(e))
143 #define LApotrs_(a,b,c,d,e,f,g,h) CPOTRS(_cptofcd((a),1),(b),(c),(d),(e),\
144                                          (f),(g),(h))
145 #define LAgemv_(a,b,c,d,e,f,g,h,i,j,k) CGEMV(_cptofcd((a),1),(b),(c),(d),(e),\
146                                         (f),(g),(h),(i),(j),(k))
147 #define LAgetrs_(a,b,c,d,e,f,g,h,i) CGETRS(_cptofcd((a),1),(b),(c),(d),(e),\
148                                         (f),(g),(h),(i))
149 #define LAtrmv_  CTRMV
150 #define LAtrsl_  CTRSL
151 #elif defined(PARCH_cray)
152 #define LApotrf_ CPOTRF
153 #define LApotrs_ CPOTRS
154 #define LAgetrs_ CGETRS
155 #define LAgemv_  CGEMV
156 #define LAtrmv_  CTRMV
157 #define LAtrsl_  CTRSL
158 #elif defined(FORTRANCAPS)
159 #define LApotrf_ ZPOTRF
160 #define LApotrs_ ZPOTRS
161 #define LAgemv_  ZGEMV
162 #define LAgetrf_ ZGETRF
163 #define LAgetrs_ ZGETRS
164 #define LAtrmv_  ZTRMV
165 #define LAtrsl_  ZTRSL
166 #elif !defined(FORTRANUNDERSCORE)
167 #define LApotrf_ zpotrf
168 #define LApotrs_ zpotrs
169 #define LAgemv_  zgemv
170 #define LAgetrs_ zgetrs
171 #define LAtrmv_  ztrmv
172 #define LAtrsl_  ztrsl
173 #else
174 #define LApotrf_ zpotrf_
175 #define LApotrs_ zpotrs_
176 #define LAgemv_  zgemv_
177 #define LAgetrs_ zgetrs_
178 #define LAtrmv_  ztrmv_
179 #define LAtrsl_  ztrsl_
180 #endif
181 
182 #endif
183 
184 #if defined(__cplusplus)
185 extern "C" {
186 #endif
187 
188 /* note that BLdot cannot be used with COMPLEX because it cannot
189    handle returing a double complex!!
190 */
191 extern double BLdot_(int*,Scalar*,int*,Scalar*,int*);
192 extern double BLnrm2_(int*,Scalar*,int*),BLasum_(int*,Scalar*,int*);
193 extern void   BLscal_(int*,Scalar*,Scalar*,int*);
194 extern void   BLcopy_(int*,Scalar*,int*,Scalar*,int*);
195 extern void   BLswap_(int*,Scalar*,int*,Scalar*,int*);
196 extern void   BLaxpy_(int*,Scalar*,Scalar*,int*,Scalar*,int*);
197 extern void   LAgetrf_(int*,int*,Scalar*,int*,int*,int*);
198 
199 #if defined(PARCH_t3d)
200 extern void   CPOTRF(_fcd,int*,Scalar*,int*,int*);
201 extern void   CGEMV(_fcd,int*,int*,Scalar*,Scalar*,int*,Scalar *,int*,
202                         Scalar*,Scalar*,int*);
203 extern void   CPOTRS(_fcd,int*,int*,Scalar*,int*,Scalar*,int*,int*);
204 extern void   CGETRS(_fcd,int*,int*,Scalar*,int*,int*,Scalar*,int*,int*);
205 #else
206 extern void   LApotrf_(char*,int*,Scalar*,int*,int*);
207 extern void   LAgemv_(char*,int*,int*,Scalar*,Scalar*,int*,Scalar *,int*,
208                        Scalar*,Scalar*,int*);
209 extern void   LApotrs_(char*,int*,int*,Scalar*,int*,Scalar*,int*,int*);
210 extern void   LAgetrs_(char*,int*,int*,Scalar*,int*,int*,Scalar*,int*,int*);
211 #endif
212 
213 #if defined(__cplusplus)
214 };
215 #endif
216 
217 #endif
218