xref: /petsc/include/petscblaslapack.h (revision c01c455d43b147fbcccdf73d28be4d01ad7032e0)
1 /* $Id: plapack.h,v 1.7 1995/07/17 20:43:22 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 "petsc.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,e,f,g,h,i,j,k,l,m)  SORMQR(_cptofcd((a),1),\
66              _cptofcd((b),1),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m))
67 #define LAtrtrs_(a,b,c,d,e,f,g,h,i,j) 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 LAtrtrs_(a,b,c,d,e,f,g,h,i,j) CTRTRS(_cptofcd((a),1),_cptofcd((b),1),\
162                               _cptofcd((c),1),(d),(e),(f),(g),(h),(i),(j))
163 #define LApotrf_(a,b,c,d,e)       CPOTRF(_cptofcd((a),1),(b),(c),(d),(e))
164 #define LApotrs_(a,b,c,d,e,f,g,h) CPOTRS(_cptofcd((a),1),(b),(c),(d),(e),\
165                                          (f),(g),(h))
166 #define LAgemv_(a,b,c,d,e,f,g,h,i,j,k) CGEMV(_cptofcd((a),1),(b),(c),(d),(e),\
167                                         (f),(g),(h),(i),(j),(k))
168 #define LAgetrs_(a,b,c,d,e,f,g,h,i) CGETRS(_cptofcd((a),1),(b),(c),(d),(e),\
169                                         (f),(g),(h),(i))
170 #define LAtrmv_  CTRMV
171 #define LAtrsl_  CTRSL
172 #elif defined(PARCH_cray)
173 #define LAormqr_ CORMQR
174 #define LAtrtrs_ CTRTRS
175 #define LApotrf_ CPOTRF
176 #define LApotrs_ CPOTRS
177 #define LAgetrs_ CGETRS
178 #define LAgemv_  CGEMV
179 #define LAtrmv_  CTRMV
180 #define LAtrsl_  CTRSL
181 #elif defined(FORTRANCAPS)
182 #define LAtrtrs_ ZTRTRS
183 #define LApotrf_ ZPOTRF
184 #define LApotrs_ ZPOTRS
185 #define LAgemv_  ZGEMV
186 #define LAgetrf_ ZGETRF
187 #define LAgetrs_ ZGETRS
188 #define LAtrmv_  ZTRMV
189 #define LAtrsl_  ZTRSL
190 #elif !defined(FORTRANUNDERSCORE)
191 #define LAtrtrs_ ztrtrs
192 #define LApotrf_ zpotrf
193 #define LApotrs_ zpotrs
194 #define LAgemv_  zgemv
195 #define LAgetrs_ zgetrs
196 #define LAtrmv_  ztrmv
197 #define LAtrsl_  ztrsl
198 #else
199 #define LAtrtrs_ ztrtrs_
200 #define LApotrf_ zpotrf_
201 #define LApotrs_ zpotrs_
202 #define LAgemv_  zgemv_
203 #define LAgetrs_ zgetrs_
204 #define LAtrmv_  ztrmv_
205 #define LAtrsl_  ztrsl_
206 #endif
207 
208 #endif
209 
210 #if defined(__cplusplus)
211 extern "C" {
212 #endif
213 
214 /* note that BLdot cannot be used with COMPLEX because it cannot
215    handle returing a double complex!!
216 */
217 extern double BLdot_(int*,Scalar*,int*,Scalar*,int*);
218 extern double BLnrm2_(int*,Scalar*,int*),BLasum_(int*,Scalar*,int*);
219 extern void   BLscal_(int*,Scalar*,Scalar*,int*);
220 extern void   BLcopy_(int*,Scalar*,int*,Scalar*,int*);
221 extern void   BLswap_(int*,Scalar*,int*,Scalar*,int*);
222 extern void   BLaxpy_(int*,Scalar*,Scalar*,int*,Scalar*,int*);
223 extern void   LAgetrf_(int*,int*,Scalar*,int*,int*,int*);
224 extern void   LAgeqrf_(int*,int*,Scalar*,int*,Scalar*,Scalar*,int*,int*);
225 
226 #if defined(PARCH_t3d)
227 extern void   CPOTRF(_fcd,int*,Scalar*,int*,int*);
228 extern void   CGEMV(_fcd,int*,int*,Scalar*,Scalar*,int*,Scalar *,int*,
229                         Scalar*,Scalar*,int*);
230 extern void   CPOTRS(_fcd,int*,int*,Scalar*,int*,Scalar*,int*,int*);
231 extern void   CGETRS(_fcd,int*,int*,Scalar*,int*,int*,Scalar*,int*,int*);
232 #else
233 extern void   LAormqr_(char*,char*,int*,int*,int*,Scalar*,int*,Scalar*,Scalar*,
234                        int*,Scalar*,int*,int*);
235 extern void   LAtrtrs_(char*,char*,char*,int*,int*,Scalar*,int*,Scalar*,int*,
236                        int*);
237 extern void   LApotrf_(char*,int*,Scalar*,int*,int*);
238 extern void   LAgemv_(char*,int*,int*,Scalar*,Scalar*,int*,Scalar *,int*,
239                        Scalar*,Scalar*,int*);
240 extern void   LApotrs_(char*,int*,int*,Scalar*,int*,Scalar*,int*,int*);
241 extern void   LAgetrs_(char*,int*,int*,Scalar*,int*,int*,Scalar*,int*,int*);
242 #endif
243 
244 #if defined(__cplusplus)
245 };
246 #endif
247 
248 #endif
249