xref: /petsc/include/petscblaslapack.h (revision d93a2b8d0462e3d094dea4dad545188cef485173)
1 /* $Id: plapack.h,v 1.5 1995/06/21 15:29:45 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 #if !defined(PETSC_COMPLEX)
22 #if defined(PARCH_cray) || defined(PARCH_t3d)
23 #define LAgeqrf_ SGEQRF
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 LAgeqrf_ DGEQRF
34 #define LAgetrf_ DGETRF
35 #define BLdot_   DDOT
36 #define BLnrm2_  DNRM2
37 #define BLscal_  DSCAL
38 #define BLcopy_  DCOPY
39 #define BLswap_  DSWAP
40 #define BLaxpy_  DAXPY
41 #define BLasum_  DASUM
42 #elif !defined(FORTRANUNDERSCORE)
43 #define LAgeqrf_ dgeqrf
44 #define LAgetrf_ dgetrf
45 #define BLdot_   ddot
46 #define BLnrm2_  dnrm2
47 #define BLscal_  dscal
48 #define BLcopy_  dcopy
49 #define BLswap_  dswap
50 #define BLaxpy_  daxpy
51 #define BLasum_  dasum
52 #else
53 #define LAgeqrf_ dgeqrf_
54 #define LAgetrf_ dgetrf_
55 #define BLdot_   ddot_
56 #define BLnrm2_  dnrm2_
57 #define BLscal_  dscal_
58 #define BLcopy_  dcopy_
59 #define BLswap_  dswap_
60 #define BLaxpy_  daxpy_
61 #define BLasum_  dasum_
62 #endif
63 
64 #if defined(PARCH_t3d)
65 #define LAormqr_(a,b,c,d,f,g,h,i,j,k,l,m,n)  SORMQR(cptofcd((a),1),\
66              cptofcd((b),1),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n))
67 #define LAtrtrs_ STRTRS(_cptofcd((a),1),_cptofcd((b),1),\
68                              _cptofcd((c),1),(d),(e),(f),(g),(h),(i),(j))
69 #define LApotrf_(a,b,c,d,e) SPOTRF(_cptofcd((a),1),(b),(c),(d),(e))
70 #define LApotrs_(a,b,c,d,e,f,g,h) SPOTRS(_cptofcd((a),1),(b),(c),(d),(e),\
71                                          (f),(g),(h))
72 #define LAgemv_(a,b,c,d,e,f,g,h,i,j,k) SGEMV(_cptofcd((a),1),(b),(c),(d),(e),\
73                                         (f),(g),(h),(i),(j),(k))
74 #define LAgetrs_(a,b,c,d,e,f,g,h,i) SGETRS(_cptofcd((a),1),(b),(c),(d),(e),\
75                                         (f),(g),(h),(i))
76 #define LAtrmv_  STRMV
77 #define LAtrsl_  STRSL
78 #elif defined(PARCH_cray)
79 #define LAormqr_ SORMQR
80 #define LAtrtrs_ STRTRS
81 #define LApotrf_ SPOTRF
82 #define LApotrs_ SPOTRS
83 #define LAgemv_  SGEMV
84 #define LAgetrs_ SGETRS
85 #define LAgemv_  SGEMV
86 #define LAtrmv_  STRMV
87 #define LAtrsl_  STRSL
88 #elif defined(FORTRANCAPS)
89 #define LAormqr_ DORMQR
90 #define LAtrtrs_ DTRTRS
91 #define LApotrf_ DPOTRF
92 #define LApotrs_ DPOTRS
93 #define LAgemv_  DGEMV
94 #define LAgetrs_ DGETRS
95 #define LAtrmv_  DTRMV
96 #define LAtrsl_  DTRSL
97 #elif !defined(FORTRANUNDERSCORE)
98 #define LAormqr_ dormqr
99 #define LAtrtrs_ dtrtrs
100 #define LApotrf_ dpotrf
101 #define LApotrs_ dpotrs
102 #define LAgemv_  dgemv
103 #define LAgetrs_ dgetrs
104 #define LAtrmv_  dtrmv
105 #define LAtrsl_  dtrsl
106 #else
107 #define LAormqr_ dormqr_
108 #define LAtrtrs_ dtrtrs_
109 #define LApotrf_ dpotrf_
110 #define LApotrs_ dpotrs_
111 #define LAgemv_  dgemv_
112 #define LAgetrs_ dgetrs_
113 #define LAtrmv_  dtrmv_
114 #define LAtrsl_  dtrsl_
115 #endif
116 
117 #else
118 
119 #if defined(PARCH_cray) || defined(PARCH_t3d)
120 #define LAgeqrf_ CGEQRF
121 #define BLdot_   CDOTC
122 #define BLnrm2_  SCNRM2
123 #define BLscal_  CSCAL
124 #define BLcopy_  CCOPY
125 #define BLswap_  CSWAP
126 #define BLaxpy_  CAXPY
127 #define BLasum_  SCASUM
128 #define LAgetrf_ CGETRF
129 #elif defined(FORTRANCAPS)
130 #define LAgeqrf_ ZGEQRF
131 #define BLdot_   ZDOTC
132 #define BLnrm2_  DZNRM2
133 #define BLscal_  ZSCAL
134 #define BLcopy_  ZCOPY
135 #define BLswap_  ZSWAP
136 #define BLaxpy_  ZAXPY
137 #define BLasum_  DZASUM
138 #elif !defined(FORTRANUNDERSCORE)
139 #define LAgeqrf_ zgeqrf
140 #define LAgetrf_ zgetrf
141 #define BLdot_   zdotc
142 #define BLnrm2_  dznrm2
143 #define BLscal_  zscal
144 #define BLcopy_  zcopy
145 #define BLswap_  zswap
146 #define BLaxpy_  zaxpy
147 #define BLasum_  dzasum
148 #else
149 #define LAgeqrf_ zgeqrf_
150 #define LAgetrf_ zgetrf_
151 #define BLdot_   zdotc_
152 #define BLnrm2_  dznrm2_
153 #define BLscal_  zscal_
154 #define BLcopy_  zcopy_
155 #define BLswap_  zswap_
156 #define BLaxpy_  zaxpy_
157 #define BLasum_  dzasum_
158 #endif
159 
160 #if defined(PARCH_t3d)
161 #define LAormqr_(a,b,c,d,f,g,h,i,j,k,l,m,n)  CORMQR(cptofcd((a),1),\
162              cptofcd((b),1),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n))
163 #define LAtrtrs_(a,b,c,d,e,f,g,h,i,j)  CTRTRS(_cptofcd((a),1),_cptofcd((b),1),\
164                               _cptofcd((c),1),(d),(e),(f),(g),(h),(i),(j))
165 #define LApotrf_(a,b,c,d,e)       CPOTRF(_cptofcd((a),1),(b),(c),(d),(e))
166 #define LApotrs_(a,b,c,d,e,f,g,h) CPOTRS(_cptofcd((a),1),(b),(c),(d),(e),\
167                                          (f),(g),(h))
168 #define LAgemv_(a,b,c,d,e,f,g,h,i,j,k) CGEMV(_cptofcd((a),1),(b),(c),(d),(e),\
169                                         (f),(g),(h),(i),(j),(k))
170 #define LAgetrs_(a,b,c,d,e,f,g,h,i) CGETRS(_cptofcd((a),1),(b),(c),(d),(e),\
171                                         (f),(g),(h),(i))
172 #define LAtrmv_  CTRMV
173 #define LAtrsl_  CTRSL
174 #elif defined(PARCH_cray)
175 #define LAormqr_ CORMQR
176 #define LAtrtrs_ CTRTRS
177 #define LApotrf_ CPOTRF
178 #define LApotrs_ CPOTRS
179 #define LAgetrs_ CGETRS
180 #define LAgemv_  CGEMV
181 #define LAtrmv_  CTRMV
182 #define LAtrsl_  CTRSL
183 #elif defined(FORTRANCAPS)
184 #define LAormqr_ ZORMQR
185 #define LAtrtrs_ ZTRTRS
186 #define LApotrf_ ZPOTRF
187 #define LApotrs_ ZPOTRS
188 #define LAgemv_  ZGEMV
189 #define LAgetrf_ ZGETRF
190 #define LAgetrs_ ZGETRS
191 #define LAtrmv_  ZTRMV
192 #define LAtrsl_  ZTRSL
193 #elif !defined(FORTRANUNDERSCORE)
194 #define LAormqr_ zormqr
195 #define LAtrtrs_ ztrtrs
196 #define LApotrf_ zpotrf
197 #define LApotrs_ zpotrs
198 #define LAgemv_  zgemv
199 #define LAgetrs_ zgetrs
200 #define LAtrmv_  ztrmv
201 #define LAtrsl_  ztrsl
202 #else
203 #define LAormqr_ zormqr_
204 #define LAtrtrs_ ztrtrs_
205 #define LApotrf_ zpotrf_
206 #define LApotrs_ zpotrs_
207 #define LAgemv_  zgemv_
208 #define LAgetrs_ zgetrs_
209 #define LAtrmv_  ztrmv_
210 #define LAtrsl_  ztrsl_
211 #endif
212 
213 #endif
214 
215 #if defined(__cplusplus)
216 extern "C" {
217 #endif
218 
219 /* note that BLdot cannot be used with COMPLEX because it cannot
220    handle returing a double complex!!
221 */
222 extern double BLdot_(int*,Scalar*,int*,Scalar*,int*);
223 extern double BLnrm2_(int*,Scalar*,int*),BLasum_(int*,Scalar*,int*);
224 extern void   BLscal_(int*,Scalar*,Scalar*,int*);
225 extern void   BLcopy_(int*,Scalar*,int*,Scalar*,int*);
226 extern void   BLswap_(int*,Scalar*,int*,Scalar*,int*);
227 extern void   BLaxpy_(int*,Scalar*,Scalar*,int*,Scalar*,int*);
228 extern void   LAgetrf_(int*,int*,Scalar*,int*,int*,int*);
229 extern void   LAgeqrf_(int*,int*,Scalar*,int*,Scalar*,Scalar*,int*,int*);
230 
231 #if defined(PARCH_t3d)
232 extern void   CPOTRF(_fcd,int*,Scalar*,int*,int*);
233 extern void   CGEMV(_fcd,int*,int*,Scalar*,Scalar*,int*,Scalar *,int*,
234                         Scalar*,Scalar*,int*);
235 extern void   CPOTRS(_fcd,int*,int*,Scalar*,int*,Scalar*,int*,int*);
236 extern void   CGETRS(_fcd,int*,int*,Scalar*,int*,int*,Scalar*,int*,int*);
237 #else
238 extern void   LAormqr_(char*,char*,int*,int*,int*,Scalar*,int*,Scalar*,Scalar*,
239                        int*,Scalar*,int*,int*);
240 extern void   LAtrtrs_(char*,char*,char*,int*,int*,Scalar*,int*,Scalar*,int*,
241                        int*);
242 extern void   LApotrf_(char*,int*,Scalar*,int*,int*);
243 extern void   LAgemv_(char*,int*,int*,Scalar*,Scalar*,int*,Scalar *,int*,
244                        Scalar*,Scalar*,int*);
245 extern void   LApotrs_(char*,int*,int*,Scalar*,int*,Scalar*,int*,int*);
246 extern void   LAgetrs_(char*,int*,int*,Scalar*,int*,int*,Scalar*,int*,int*);
247 #endif
248 
249 #if defined(__cplusplus)
250 };
251 #endif
252 
253 #endif
254