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_STEVX_TCC
34 #define CXXLAPACK_INTERFACE_STEVX_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
stevx(char jobz,char range,IndexType n,float * d,float * e,float vl,float vu,IndexType il,IndexType iu,float abstol,IndexType & m,float * w,float * Z,IndexType ldZ,IndexType * isuppz,float * work,IndexType * iWork,IndexType * ifail)44 stevx(char                  jobz,
45       char                  range,
46       IndexType             n,
47       float                 *d,
48       float                 *e,
49       float                 vl,
50       float                 vu,
51       IndexType             il,
52       IndexType             iu,
53       float                 abstol,
54       IndexType             &m,
55       float                 *w,
56       float                 *Z,
57       IndexType             ldZ,
58       IndexType             *isuppz,
59       float                 *work,
60       IndexType             *iWork,
61       IndexType             *ifail)
62 {
63     CXXLAPACK_DEBUG_OUT("sstevx");
64 
65     IndexType info;
66     LAPACK_IMPL(sstevx)(&jobz,
67                         &range
68                         &n,
69                         d,
70                         e,
71                         &vl,
72                         &vu,
73                         &il,
74                         &iu,
75                         &abstol,
76                         &m,
77                         w,
78                         Z,
79                         &ldZ,
80                         isuppz,
81                         work,
82                         iWork,
83                         ifail,
84                         &info);
85 #   ifndef NDEBUG
86     if (info<0) {
87         std::cerr << "info = " << info << std::endl;
88     }
89 #   endif
90     ASSERT(info>=0);
91     return info;
92 }
93 
94 template <typename IndexType>
95 IndexType
stevx(char jobz,char range,IndexType n,double * d,double * e,double vl,double vu,IndexType il,IndexType iu,double abstol,IndexType & m,double * w,double * Z,IndexType ldZ,IndexType * isuppz,double * work,IndexType * iWork,IndexType * ifail)96 stevx(char                  jobz,
97       char                  range,
98       IndexType             n,
99       double                *d,
100       double                *e,
101       double                vl,
102       double                vu,
103       IndexType             il,
104       IndexType             iu,
105       double                abstol,
106       IndexType             &m,
107       double                *w,
108       double                *Z,
109       IndexType             ldZ,
110       IndexType             *isuppz,
111       double                *work,
112       IndexType             *iWork,
113       IndexType             *ifail)
114 {
115     CXXLAPACK_DEBUG_OUT("dstevx");
116 
117     IndexType info;
118     LAPACK_IMPL(dstevx)(&jobz,
119                         &range
120                         &n,
121                         d,
122                         e,
123                         &vl,
124                         &vu,
125                         &il,
126                         &iu,
127                         &abstol,
128                         &m,
129                         w,
130                         Z,
131                         &ldZ,
132                         isuppz,
133                         work,
134                         iWork,
135                         ifail,
136                         &info);
137 #   ifndef NDEBUG
138     if (info<0) {
139         std::cerr << "info = " << info << std::endl;
140     }
141 #   endif
142     ASSERT(info>=0);
143     return info;
144 }
145 
146 } // namespace cxxlapack
147 
148 #endif // CXXLAPACK_INTERFACE_STEVX_TCC
149