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_LAEXC_TCC
34 #define CXXLAPACK_INTERFACE_LAEXC_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
laexc(bool wantQ,IndexType n,float * T,IndexType ldT,float * Q,IndexType ldQ,IndexType j1,IndexType n1,IndexType n2,float * work)44 laexc(bool          wantQ,
45       IndexType     n,
46       float         *T,
47       IndexType     ldT,
48       float         *Q,
49       IndexType     ldQ,
50       IndexType     j1,
51       IndexType     n1,
52       IndexType     n2,
53       float         *work)
54 {
55     CXXLAPACK_DEBUG_OUT("slaexc");
56 
57     IndexType info;
58     IndexType wantQ_ = wantQ;
59     LAPACK_IMPL(slaexc)(&wantQ_,
60                         &n,
61                         T,
62                         &ldT,
63                         Q,
64                         &ldQ,
65                         &j1,
66                         &n1,
67                         &n2,
68                         work,
69                         &info);
70 #   ifndef NDEBUG
71     if (info<0) {
72         std::cerr << "info = " << info << std::endl;
73     }
74 #   endif
75     ASSERT(info>=0);
76     return info;
77 }
78 
79 template <typename IndexType>
80 IndexType
laexc(bool wantQ,IndexType n,double * T,IndexType ldT,double * Q,IndexType ldQ,IndexType j1,IndexType n1,IndexType n2,double * work)81 laexc(bool          wantQ,
82       IndexType     n,
83       double        *T,
84       IndexType     ldT,
85       double        *Q,
86       IndexType     ldQ,
87       IndexType     j1,
88       IndexType     n1,
89       IndexType     n2,
90       double        *work)
91 {
92     CXXLAPACK_DEBUG_OUT("dlaexc");
93 
94     IndexType info;
95     IndexType wantQ_ = wantQ;
96     LAPACK_IMPL(dlaexc)(&wantQ_,
97                         &n,
98                         T,
99                         &ldT,
100                         Q,
101                         &ldQ,
102                         &j1,
103                         &n1,
104                         &n2,
105                         work,
106                         &info);
107 #   ifndef NDEBUG
108     if (info<0) {
109         std::cerr << "info = " << info << std::endl;
110     }
111 #   endif
112     ASSERT(info>=0);
113     return info;
114 }
115 
116 } // namespace cxxlapack
117 
118 #endif // CXXLAPACK_INTERFACE_LAEXC_TCC
119