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_LAEBZ_TCC
34 #define CXXLAPACK_INTERFACE_LAEBZ_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
laebz(IndexType ijob,IndexType nitmax,IndexType n,IndexType mmax,IndexType minp,IndexType nbmin,float abstol,float reltol,float pivmin,const float * d,const float * e,const float * e2,IndexType * nval,float * Ab,float * c,IndexType & mout,IndexType * NAb,float * work,IndexType * iWork)44 laebz(IndexType             ijob,
45       IndexType             nitmax,
46       IndexType             n,
47       IndexType             mmax,
48       IndexType             minp,
49       IndexType             nbmin,
50       float                 abstol,
51       float                  reltol,
52       float                 pivmin,
53       const float           *d,
54       const float           *e,
55       const float           *e2,
56       IndexType             *nval,
57       float                 *Ab,
58       float                 *c,
59       IndexType             &mout,
60       IndexType             *NAb,
61       float                 *work,
62       IndexType             *iWork)
63 {
64     CXXLAPACK_DEBUG_OUT("slaebz");
65 
66     IndexType info;
67     LAPACK_IMPL(slaebz)(&ijob,
68                         &nitmax,
69                         &n,
70                         &mmax,
71                         &minp,
72                         &nbmin,
73                         &abstol,
74                         &reltol,
75                         &pivmin,
76                         d,
77                         e,
78                         e2,
79                         nval,
80                         Ab,
81                         c,
82                         &mout,
83                         NAb,
84                         work,
85                         iWork,
86                         &info);
87 #   ifndef NDEBUG
88     if (info<0) {
89         std::cerr << "info = " << info << std::endl;
90     }
91 #   endif
92     ASSERT(info>=0);
93     return info;
94 }
95 template <typename IndexType>
96 IndexType
laebz(IndexType ijob,IndexType nitmax,IndexType n,IndexType mmax,IndexType minp,IndexType nbmin,double abstol,double reltol,double pivmin,const double * d,const double * e,const double * e2,IndexType * nval,double * Ab,double * c,IndexType & mout,IndexType * NAb,double * work,IndexType * iWork)97 laebz(IndexType             ijob,
98       IndexType             nitmax,
99       IndexType             n,
100       IndexType             mmax,
101       IndexType             minp,
102       IndexType             nbmin,
103       double                abstol,
104       double                reltol,
105       double                pivmin,
106       const double          *d,
107       const double          *e,
108       const double          *e2,
109       IndexType             *nval,
110       double                *Ab,
111       double                *c,
112       IndexType             &mout,
113       IndexType             *NAb,
114       double                *work,
115       IndexType             *iWork)
116 {
117     CXXLAPACK_DEBUG_OUT("dlaebz");
118 
119     IndexType info;
120     LAPACK_IMPL(dlaebz)(&ijob,
121                         &nitmax,
122                         &n,
123                         &mmax,
124                         &minp,
125                         &nbmin,
126                         &abstol,
127                         &reltol,
128                         &pivmin,
129                         d,
130                         e,
131                         e2,
132                         nval,
133                         Ab,
134                         c,
135                         &mout,
136                         NAb,
137                         work,
138                         iWork,
139                         &info);
140 #   ifndef NDEBUG
141     if (info<0) {
142         std::cerr << "info = " << info << std::endl;
143     }
144 #   endif
145     ASSERT(info>=0);
146     return info;
147 }
148 
149 } // namespace cxxlapack
150 
151 #endif // CXXLAPACK_INTERFACE_LAEBZ_TCC
152