1 /*
2 * Copyright (c) 2012, Michael Lehn
3 *
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1) Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2) Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 * 3) Neither the name of the FLENS development group nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33 #ifndef CXXLAPACK_INTERFACE_GEEVX_TCC
34 #define CXXLAPACK_INTERFACE_GEEVX_TCC 1
35
36 #include <iostream>
37 #include "xflens/cxxlapack/interface/interface.h"
38 #include "xflens/cxxlapack/netlib/netlib.h"
39
40 namespace cxxlapack {
41
42 template <typename IndexType>
43 IndexType
geevx(char balanc,char jobVL,char jobVR,char sense,IndexType n,float * A,IndexType ldA,float * wr,float * wi,float * VL,IndexType ldVL,float * VR,IndexType ldVR,IndexType & iLo,IndexType & iHi,float * scale,float & ABnorm,float * rCondE,float * rCondV,float * work,IndexType lWork,IndexType * iWork)44 geevx(char balanc,
45 char jobVL,
46 char jobVR,
47 char sense,
48 IndexType n,
49 float *A,
50 IndexType ldA,
51 float *wr,
52 float *wi,
53 float *VL,
54 IndexType ldVL,
55 float *VR,
56 IndexType ldVR,
57 IndexType &iLo,
58 IndexType &iHi,
59 float *scale,
60 float &ABnorm,
61 float *rCondE,
62 float *rCondV,
63 float *work,
64 IndexType lWork,
65 IndexType *iWork)
66 {
67 IndexType info;
68 CXXLAPACK_DEBUG_OUT("sgeevx");
69 LAPACK_IMPL(sgeevx)(&balanc,
70 &jobVL,
71 &jobVR,
72 &sense,
73 &n,
74 A,
75 &ldA,
76 wr,
77 wi,
78 VL,
79 &ldVL,
80 VR,
81 &ldVR,
82 &iLo,
83 &iHi,
84 scale,
85 &ABnorm,
86 rCondE,
87 rCondV,
88 work,
89 &lWork,
90 iWork,
91 &info);
92 # ifndef NDEBUG
93 if (info<0) {
94 std::cerr << "info = " << info << std::endl;
95 }
96 # endif
97 ASSERT(info>=0);
98 return info;
99 }
100
101 template <typename IndexType>
102 IndexType
geevx(char balanc,char jobVL,char jobVR,char sense,IndexType n,double * A,IndexType ldA,double * wr,double * wi,double * VL,IndexType ldVL,double * VR,IndexType ldVR,IndexType & iLo,IndexType & iHi,double * scale,double & ABnorm,double * rCondE,double * rCondV,double * work,IndexType lWork,IndexType * iWork)103 geevx(char balanc,
104 char jobVL,
105 char jobVR,
106 char sense,
107 IndexType n,
108 double *A,
109 IndexType ldA,
110 double *wr,
111 double *wi,
112 double *VL,
113 IndexType ldVL,
114 double *VR,
115 IndexType ldVR,
116 IndexType &iLo,
117 IndexType &iHi,
118 double *scale,
119 double &ABnorm,
120 double *rCondE,
121 double *rCondV,
122 double *work,
123 IndexType lWork,
124 IndexType *iWork)
125 {
126 IndexType info;
127 CXXLAPACK_DEBUG_OUT("dgeevx");
128 LAPACK_IMPL(dgeevx)(&balanc,
129 &jobVL,
130 &jobVR,
131 &sense,
132 &n,
133 A,
134 &ldA,
135 wr,
136 wi,
137 VL,
138 &ldVL,
139 VR,
140 &ldVR,
141 &iLo,
142 &iHi,
143 scale,
144 &ABnorm,
145 rCondE,
146 rCondV,
147 work,
148 &lWork,
149 iWork,
150 &info);
151 # ifndef NDEBUG
152 if (info<0) {
153 std::cerr << "info = " << info << std::endl;
154 }
155 # endif
156 ASSERT(info>=0);
157 return info;
158 }
159
160 template <typename IndexType>
161 IndexType
geevx(char balanc,char jobVL,char jobVR,char sense,IndexType n,std::complex<float> * A,IndexType ldA,std::complex<float> * w,std::complex<float> * VL,IndexType ldVL,std::complex<float> * VR,IndexType ldVR,IndexType & iLo,IndexType & iHi,float * scale,float & ABnorm,float * rCondE,float * rCondV,std::complex<float> * work,IndexType lWork,float * rWork)162 geevx(char balanc,
163 char jobVL,
164 char jobVR,
165 char sense,
166 IndexType n,
167 std::complex<float > *A,
168 IndexType ldA,
169 std::complex<float > *w,
170 std::complex<float > *VL,
171 IndexType ldVL,
172 std::complex<float > *VR,
173 IndexType ldVR,
174 IndexType &iLo,
175 IndexType &iHi,
176 float *scale,
177 float &ABnorm,
178 float *rCondE,
179 float *rCondV,
180 std::complex<float > *work,
181 IndexType lWork,
182 float *rWork)
183 {
184 IndexType info;
185 CXXLAPACK_DEBUG_OUT("cgeevx");
186 LAPACK_IMPL(cgeevx)(&balanc,
187 &jobVL,
188 &jobVR,
189 &sense,
190 &n,
191 reinterpret_cast<float *>(A),
192 &ldA,
193 reinterpret_cast<float *>(w),
194 reinterpret_cast<float *>(VL),
195 &ldVL,
196 reinterpret_cast<float *>(VR),
197 &ldVR,
198 &iLo,
199 &iHi,
200 scale,
201 &ABnorm,
202 rCondE,
203 rCondV,
204 reinterpret_cast<float *>(work),
205 &lWork,
206 rWork,
207 &info);
208 # ifndef NDEBUG
209 if (info<0) {
210 std::cerr << "info = " << info << std::endl;
211 }
212 # endif
213 ASSERT(info>=0);
214 return info;
215 }
216
217 template <typename IndexType>
218 IndexType
geevx(char balanc,char jobVL,char jobVR,char sense,IndexType n,std::complex<double> * A,IndexType ldA,std::complex<double> * w,std::complex<double> * VL,IndexType ldVL,std::complex<double> * VR,IndexType ldVR,IndexType & iLo,IndexType & iHi,double * scale,double & ABnorm,double * rCondE,double * rCondV,std::complex<double> * work,IndexType lWork,double * rWork)219 geevx(char balanc,
220 char jobVL,
221 char jobVR,
222 char sense,
223 IndexType n,
224 std::complex<double> *A,
225 IndexType ldA,
226 std::complex<double> *w,
227 std::complex<double> *VL,
228 IndexType ldVL,
229 std::complex<double> *VR,
230 IndexType ldVR,
231 IndexType &iLo,
232 IndexType &iHi,
233 double *scale,
234 double &ABnorm,
235 double *rCondE,
236 double *rCondV,
237 std::complex<double> *work,
238 IndexType lWork,
239 double *rWork)
240 {
241 IndexType info;
242 CXXLAPACK_DEBUG_OUT("zgeevx");
243 LAPACK_IMPL(zgeevx)(&balanc,
244 &jobVL,
245 &jobVR,
246 &sense,
247 &n,
248 reinterpret_cast<double *>(A),
249 &ldA,
250 reinterpret_cast<double *>(w),
251 reinterpret_cast<double *>(VL),
252 &ldVL,
253 reinterpret_cast<double *>(VR),
254 &ldVR,
255 &iLo,
256 &iHi,
257 scale,
258 &ABnorm,
259 rCondE,
260 rCondV,
261 reinterpret_cast<double *>(work),
262 &lWork,
263 rWork,
264 &info);
265 # ifndef NDEBUG
266 if (info<0) {
267 std::cerr << "info = " << info << std::endl;
268 }
269 # endif
270 ASSERT(info>=0);
271 return info;
272 }
273
274 } // namespace cxxlapack
275
276 #endif // CXXLAPACK_INTERFACE_GEEVX_TCC
277