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_HBGVX_TCC
34 #define CXXLAPACK_INTERFACE_HBGVX_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
hbgvx(char jobz,char range,IndexType n,IndexType ka,IndexType kb,std::complex<float> * Ab,IndexType ldAb,std::complex<float> * Bb,IndexType ldBb,std::complex<float> * Q,IndexType ldQ,float vl,float vu,IndexType il,IndexType iu,float abstol,IndexType & m,float * w,std::complex<float> * Z,IndexType ldZ,std::complex<float> * work,float * rWork,IndexType * iWork,IndexType * ifail)44 hbgvx(char jobz,
45 char range,
46 IndexType n,
47 IndexType ka,
48 IndexType kb,
49 std::complex<float > *Ab,
50 IndexType ldAb,
51 std::complex<float > *Bb,
52 IndexType ldBb,
53 std::complex<float > *Q,
54 IndexType ldQ,
55 float vl,
56 float vu,
57 IndexType il,
58 IndexType iu,
59 float abstol,
60 IndexType &m,
61 float *w,
62 std::complex<float > *Z,
63 IndexType ldZ,
64 std::complex<float > *work,
65 float *rWork,
66 IndexType *iWork,
67 IndexType *ifail)
68 {
69 CXXLAPACK_DEBUG_OUT("chbgvx");
70
71 IndexType info;
72 LAPACK_IMPL(chbgvx)(&jobz,
73 &range,
74 &n,
75 &ka,
76 &kb,
77 reinterpret_cast<float *>(Ab),
78 &ldAb,
79 reinterpret_cast<float *>(Bb),
80 &ldBb,
81 reinterpret_cast<float *>(Q),
82 &ldQ,
83 &vl,
84 &vu,
85 &il,
86 &iu,
87 &abstol,
88 &m,
89 w,
90 reinterpret_cast<float *>(Z),
91 &ldZ,
92 reinterpret_cast<float *>(work),
93 rWork,
94 iWork,
95 ifail,
96 &info);
97 # ifndef NDEBUG
98 if (info<0) {
99 std::cerr << "info = " << info << std::endl;
100 }
101 # endif
102 ASSERT(info>=0);
103 return info;
104 }
105
106 template <typename IndexType>
107 IndexType
hbgvx(char jobz,char range,IndexType n,IndexType ka,IndexType kb,std::complex<double> * Ab,IndexType ldAb,std::complex<double> * Bb,IndexType ldBb,std::complex<double> * Q,IndexType ldQ,double vl,double vu,IndexType il,IndexType iu,double abstol,IndexType & m,double * w,std::complex<double> * Z,IndexType ldZ,std::complex<double> * work,double * rWork,IndexType * iWork,IndexType * ifail)108 hbgvx(char jobz,
109 char range,
110 IndexType n,
111 IndexType ka,
112 IndexType kb,
113 std::complex<double> *Ab,
114 IndexType ldAb,
115 std::complex<double> *Bb,
116 IndexType ldBb,
117 std::complex<double> *Q,
118 IndexType ldQ,
119 double vl,
120 double vu,
121 IndexType il,
122 IndexType iu,
123 double abstol,
124 IndexType &m,
125 double *w,
126 std::complex<double> *Z,
127 IndexType ldZ,
128 std::complex<double> *work,
129 double *rWork,
130 IndexType *iWork,
131 IndexType *ifail)
132 {
133 CXXLAPACK_DEBUG_OUT("zhbgvx");
134
135 IndexType info;
136 LAPACK_IMPL(zhbgvx)(&jobz,
137 &range,
138 &n,
139 &ka,
140 &kb,
141 reinterpret_cast<double *>(Ab),
142 &ldAb,
143 reinterpret_cast<double *>(Bb),
144 &ldBb,
145 reinterpret_cast<double *>(Q),
146 &ldQ,
147 &vl,
148 &vu,
149 &il,
150 &iu,
151 &abstol,
152 &m,
153 w,
154 reinterpret_cast<double *>(Z),
155 &ldZ,
156 reinterpret_cast<double *>(work),
157 rWork,
158 iWork,
159 ifail,
160 &info);
161 # ifndef NDEBUG
162 if (info<0) {
163 std::cerr << "info = " << info << std::endl;
164 }
165 # endif
166 ASSERT(info>=0);
167 return info;
168 }
169
170 } // namespace cxxlapack
171
172 #endif // CXXLAPACK_INTERFACE_HBGVX_TCC
173