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_LA_PORCOND_TCC
34 #define CXXLAPACK_INTERFACE_LA_PORCOND_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 float
la_porCond(char uplo,IndexType n,const float * A,IndexType ldA,const float * Af,IndexType ldAf,IndexType cmode,const float * c,IndexType & info,float * work,IndexType * iWork)44 la_porCond(char                  uplo,
45            IndexType             n,
46            const float           *A,
47            IndexType             ldA,
48            const float           *Af,
49            IndexType             ldAf,
50            IndexType             cmode,
51            const float           *c,
52            IndexType             &info,
53            float                 *work,
54            IndexType             *iWork)
55 {
56     CXXLAPACK_DEBUG_OUT("sla_porcond");
57 
58     float  val = LAPACK_IMPL(sla_porcond)(&uplo,
59                                           &n,
60                                           A,
61                                           &ldA,
62                                           Af,
63                                           &ldAf,
64                                           &cmode,
65                                           c,
66                                           &info,
67                                           work,
68                                           iWork);
69 #   ifndef NDEBUG
70     if (info<0) {
71         std::cerr << "info = " << info << std::endl;
72     }
73 #   endif
74     ASSERT(info>=0);
75     return val;
76 }
77 
78 template <typename IndexType>
79 double
la_porCond(char uplo,IndexType n,const double * A,IndexType ldA,const double * Af,IndexType ldAf,IndexType cmode,const double * c,IndexType & info,double * work,IndexType * iWork)80 la_porCond(char                  uplo,
81            IndexType             n,
82            const double          *A,
83            IndexType             ldA,
84            const double          *Af,
85            IndexType             ldAf,
86            IndexType             cmode,
87            const double          *c,
88            IndexType             &info,
89            double                *work,
90            IndexType             *iWork)
91 {
92     CXXLAPACK_DEBUG_OUT("dla_porcond");
93 
94     double val = LAPACK_IMPL(dla_porcond)(&uplo,
95                                           &n,
96                                           A,
97                                           &ldA,
98                                           Af,
99                                           &ldAf,
100                                           &cmode,
101                                           c,
102                                           &info,
103                                           work,
104                                           iWork);
105 #   ifndef NDEBUG
106     if (info<0) {
107         std::cerr << "info = " << info << std::endl;
108     }
109 #   endif
110     ASSERT(info>=0);
111     return val;
112 }
113 
114 
115 } // namespace cxxlapack
116 
117 #endif // CXXLAPACK_INTERFACE_LA_PORCOND_TCC
118