1 /*
2 * Copyright (c) 2012, Michael Lehn, Klaus Pototzky
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_LALS0_TCC
34 #define CXXLAPACK_INTERFACE_LALS0_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
lals0(IndexType icomq,IndexType nl,IndexType nr,IndexType sqre,IndexType nRhs,float * B,IndexType ldB,float * Bx,IndexType ldBx,const IndexType * perm,IndexType givptr,const IndexType * Givcol,IndexType ldGcol,const float * Givnum,IndexType ldGnum,const float * Poles,const float * difl,const float * difr,const float * z,IndexType k,float c,float s,float * work)44 lals0(IndexType icomq,
45 IndexType nl,
46 IndexType nr,
47 IndexType sqre,
48 IndexType nRhs,
49 float *B,
50 IndexType ldB,
51 float *Bx,
52 IndexType ldBx,
53 const IndexType *perm,
54 IndexType givptr,
55 const IndexType *Givcol,
56 IndexType ldGcol,
57 const float *Givnum,
58 IndexType ldGnum,
59 const float *Poles,
60 const float *difl,
61 const float *difr,
62 const float *z,
63 IndexType k,
64 float c,
65 float s,
66 float *work)
67 {
68 CXXLAPACK_DEBUG_OUT("slals0");
69
70 IndexType info;
71 LAPACK_IMPL(slals0)(&icomq,
72 &nl,
73 &nr,
74 &sqre,
75 &nRhs,
76 B,
77 &ldB,
78 Bx,
79 &ldBx,
80 perm,
81 givptr,
82 Givcol,
83 &ldGcol,
84 Givnum,
85 &ldGnum,
86 Poles,
87 difl,
88 difr,
89 z,
90 &k,
91 &c,
92 &s,
93 work,
94 &info);
95 # ifndef NDEBUG
96 if (info<0) {
97 std::cerr << "info = " << info << std::endl;
98 }
99 # endif
100 ASSERT(info>=0);
101 return info;
102 }
103
104
105 template <typename IndexType>
106 IndexType
lals0(IndexType icomq,IndexType nl,IndexType nr,IndexType sqre,IndexType nRhs,double * B,IndexType ldB,double * Bx,IndexType ldBx,const IndexType * perm,IndexType givptr,const IndexType * Givcol,IndexType ldGcol,const double * Givnum,IndexType ldGnum,const double * Poles,const double * difl,const double * difr,const double * z,IndexType k,double c,double s,double * work)107 lals0(IndexType icomq,
108 IndexType nl,
109 IndexType nr,
110 IndexType sqre,
111 IndexType nRhs,
112 double *B,
113 IndexType ldB,
114 double *Bx,
115 IndexType ldBx,
116 const IndexType *perm,
117 IndexType givptr,
118 const IndexType *Givcol,
119 IndexType ldGcol,
120 const double *Givnum,
121 IndexType ldGnum,
122 const double *Poles,
123 const double *difl,
124 const double *difr,
125 const double *z,
126 IndexType k,
127 double c,
128 double s,
129 double *work)
130 {
131 CXXLAPACK_DEBUG_OUT("dlals0");
132
133 IndexType info;
134 LAPACK_IMPL(dlals0)(&icomq,
135 &nl,
136 &nr,
137 &sqre,
138 &nRhs,
139 B,
140 &ldB,
141 Bx,
142 &ldBx,
143 perm,
144 givptr,
145 Givcol,
146 &ldGcol,
147 Givnum,
148 &ldGnum,
149 Poles,
150 difl,
151 difr,
152 z,
153 &k,
154 &c,
155 &s,
156 work,
157 &info);
158 # ifndef NDEBUG
159 if (info<0) {
160 std::cerr << "info = " << info << std::endl;
161 }
162 # endif
163 ASSERT(info>=0);
164 return info;
165 }
166
167 template <typename IndexType>
168 IndexType
lals0(IndexType icomq,IndexType nl,IndexType nr,IndexType sqre,IndexType nRhs,std::complex<float> * B,IndexType ldB,std::complex<float> * Bx,IndexType ldBx,const IndexType * perm,IndexType givptr,const IndexType * Givcol,IndexType ldGcol,const float * Givnum,IndexType ldGnum,const float * Poles,const float * difl,const float * difr,const float * z,IndexType k,float c,float s,float * rWork)169 lals0(IndexType icomq,
170 IndexType nl,
171 IndexType nr,
172 IndexType sqre,
173 IndexType nRhs,
174 std::complex<float > *B,
175 IndexType ldB,
176 std::complex<float > *Bx,
177 IndexType ldBx,
178 const IndexType *perm,
179 IndexType givptr,
180 const IndexType *Givcol,
181 IndexType ldGcol,
182 const float *Givnum,
183 IndexType ldGnum,
184 const float *Poles,
185 const float *difl,
186 const float *difr,
187 const float *z,
188 IndexType k,
189 float c,
190 float s,
191 float *rWork)
192 {
193 CXXLAPACK_DEBUG_OUT("clals0");
194
195 IndexType info;
196 LAPACK_IMPL(clals0)(&icomq,
197 &nl,
198 &nr,
199 &sqre,
200 &nRhs,
201 reinterpret_cast<float *>(B),
202 &ldB,
203 reinterpret_cast<float *>(Bx),
204 &ldBx,
205 perm,
206 givptr,
207 Givcol,
208 &ldGcol,
209 Givnum,
210 &ldGnum,
211 Poles,
212 difl,
213 difr,
214 z,
215 &k,
216 &c,
217 &s,
218 rWork,
219 &info);
220 # ifndef NDEBUG
221 if (info<0) {
222 std::cerr << "info = " << info << std::endl;
223 }
224 # endif
225 ASSERT(info>=0);
226 return info;
227 }
228
229
230 template <typename IndexType>
231 IndexType
lals0(IndexType icomq,IndexType nl,IndexType nr,IndexType sqre,IndexType nRhs,std::complex<double> * B,IndexType ldB,std::complex<double> * Bx,IndexType ldBx,const IndexType * perm,IndexType givptr,const IndexType * Givcol,IndexType ldGcol,const double * Givnum,IndexType ldGnum,const double * Poles,const double * difl,const double * difr,const double * z,IndexType k,double c,double s,double * rWork)232 lals0(IndexType icomq,
233 IndexType nl,
234 IndexType nr,
235 IndexType sqre,
236 IndexType nRhs,
237 std::complex<double> *B,
238 IndexType ldB,
239 std::complex<double> *Bx,
240 IndexType ldBx,
241 const IndexType *perm,
242 IndexType givptr,
243 const IndexType *Givcol,
244 IndexType ldGcol,
245 const double *Givnum,
246 IndexType ldGnum,
247 const double *Poles,
248 const double *difl,
249 const double *difr,
250 const double *z,
251 IndexType k,
252 double c,
253 double s,
254 double *rWork)
255 {
256 CXXLAPACK_DEBUG_OUT("zlals0");
257
258 IndexType info;
259 LAPACK_IMPL(zlals0)(&icomq,
260 &nl,
261 &nr,
262 &sqre,
263 &nRhs,
264 reinterpret_cast<double *>(B),
265 &ldB,
266 reinterpret_cast<double *>(Bx),
267 &ldBx,
268 perm,
269 givptr,
270 Givcol,
271 &ldGcol,
272 Givnum,
273 &ldGnum,
274 Poles,
275 difl,
276 difr,
277 z,
278 &k,
279 &c,
280 &s,
281 rWork,
282 &info);
283 # ifndef NDEBUG
284 if (info<0) {
285 std::cerr << "info = " << info << std::endl;
286 }
287 # endif
288 ASSERT(info>=0);
289 return info;
290 }
291
292 } // namespace cxxlapack
293
294 #endif // CXXLAPACK_INTERFACE_LALS0_TCC
295