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_ORBDB_TCC
34 #define CXXLAPACK_INTERFACE_ORBDB_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
orbdb(char trans,char signs,IndexType m,IndexType p,IndexType q,float * X11,IndexType ldX11,float * X12,IndexType ldX12,float * X21,IndexType ldX21,float * X22,IndexType ldX22,float * theta,float * phi,float * taup1,float * taup2,float * tauq1,float * tauq2,float * work,IndexType lWork)44 orbdb(char                  trans,
45       char                  signs,
46       IndexType             m,
47       IndexType             p,
48       IndexType             q,
49       float                 *X11,
50       IndexType             ldX11,
51       float                 *X12,
52       IndexType             ldX12,
53       float                 *X21,
54       IndexType             ldX21,
55       float                 *X22,
56       IndexType             ldX22,
57       float                 *theta,
58       float                 *phi,
59       float                 *taup1,
60       float                 *taup2,
61       float                 *tauq1,
62       float                 *tauq2,
63       float                 *work,
64       IndexType             lWork)
65 {
66     CXXLAPACK_DEBUG_OUT("sorbdb");
67 
68     IndexType info;
69     LAPACK_IMPL(sorbdb)(&trans,
70                         &signs,
71                         &m,
72                         &p,
73                         &q,
74                         X11,
75                         &ldX11,
76                         X12,
77                         &ldX12,
78                         X21,
79                         &ldX21,
80                         X22,
81                         &ldX22,
82                         theta,
83                         phi,
84                         taup1,
85                         taup2,
86                         tauq1,
87                         tauq2,
88                         work,
89                         &lWork,
90                         &info);
91 #   ifndef NDEBUG
92     if (info<0) {
93         std::cerr << "info = " << info << std::endl;
94     }
95 #   endif
96     ASSERT(info>=0);
97     return info;
98 }
99 
100 template <typename IndexType>
101 IndexType
orbdb(char trans,char signs,IndexType m,IndexType p,IndexType q,double * X11,IndexType ldX11,double * X12,IndexType ldX12,double * X21,IndexType ldX21,double * X22,IndexType ldX22,double * theta,double * phi,double * taup1,double * taup2,double * tauq1,double * tauq2,double * work,IndexType lWork)102 orbdb(char                  trans,
103       char                  signs,
104       IndexType             m,
105       IndexType             p,
106       IndexType             q,
107       double                *X11,
108       IndexType             ldX11,
109       double                *X12,
110       IndexType             ldX12,
111       double                *X21,
112       IndexType             ldX21,
113       double                *X22,
114       IndexType             ldX22,
115       double                *theta,
116       double                *phi,
117       double                *taup1,
118       double                *taup2,
119       double                *tauq1,
120       double                *tauq2,
121       double                *work,
122       IndexType             lWork)
123 {
124     CXXLAPACK_DEBUG_OUT("dorbdb");
125 
126     IndexType info;
127     LAPACK_IMPL(dorbdb)(&trans,
128                         &signs,
129                         &m,
130                         &p,
131                         &q,
132                         X11,
133                         &ldX11,
134                         X12,
135                         &ldX12,
136                         X21,
137                         &ldX21,
138                         X22,
139                         &ldX22,
140                         theta,
141                         phi,
142                         taup1,
143                         taup2,
144                         tauq1,
145                         tauq2,
146                         work,
147                         &lWork,
148                         &info);
149 #   ifndef NDEBUG
150     if (info<0) {
151         std::cerr << "info = " << info << std::endl;
152     }
153 #   endif
154     ASSERT(info>=0);
155     return info;
156 }
157 
158 } // namespace cxxlapack
159 
160 #endif // CXXLAPACK_INTERFACE_ORBDB_TCC
161