1 //
2 // Copyright (c) 2002--2010
3 // Toon Knapen, Karl Meerbergen, Kresimir Fresl,
4 // Thomas Klimpel and Rutger ter Borg
5 //
6 // Distributed under the Boost Software License, Version 1.0.
7 // (See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
9 //
10 // THIS FILE IS AUTOMATICALLY GENERATED
11 // PLEASE DO NOT EDIT!
12 //
13 
14 #ifndef BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_PBTRF_HPP
15 #define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_PBTRF_HPP
16 
17 #include <boost/assert.hpp>
18 #include <boost/numeric/bindings/bandwidth.hpp>
19 #include <boost/numeric/bindings/begin.hpp>
20 #include <boost/numeric/bindings/is_column_major.hpp>
21 #include <boost/numeric/bindings/is_mutable.hpp>
22 #include <boost/numeric/bindings/remove_imaginary.hpp>
23 #include <boost/numeric/bindings/size.hpp>
24 #include <boost/numeric/bindings/stride.hpp>
25 #include <boost/numeric/bindings/uplo_tag.hpp>
26 #include <boost/numeric/bindings/value_type.hpp>
27 #include <boost/static_assert.hpp>
28 #include <boost/type_traits/is_same.hpp>
29 #include <boost/type_traits/remove_const.hpp>
30 
31 //
32 // The LAPACK-backend for pbtrf is the netlib-compatible backend.
33 //
34 #include <boost/numeric/bindings/lapack/detail/lapack.h>
35 #include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
36 
37 namespace boost {
38 namespace numeric {
39 namespace bindings {
40 namespace lapack {
41 
42 //
43 // The detail namespace contains value-type-overloaded functions that
44 // dispatch to the appropriate back-end LAPACK-routine.
45 //
46 namespace detail {
47 
48 //
49 // Overloaded function for dispatching to
50 // * netlib-compatible LAPACK backend (the default), and
51 // * float value-type.
52 //
53 template< typename UpLo >
pbtrf(const UpLo,const fortran_int_t n,const fortran_int_t kd,float * ab,const fortran_int_t ldab)54 inline std::ptrdiff_t pbtrf( const UpLo, const fortran_int_t n,
55         const fortran_int_t kd, float* ab, const fortran_int_t ldab ) {
56     fortran_int_t info(0);
57     LAPACK_SPBTRF( &lapack_option< UpLo >::value, &n, &kd, ab, &ldab, &info );
58     return info;
59 }
60 
61 //
62 // Overloaded function for dispatching to
63 // * netlib-compatible LAPACK backend (the default), and
64 // * double value-type.
65 //
66 template< typename UpLo >
pbtrf(const UpLo,const fortran_int_t n,const fortran_int_t kd,double * ab,const fortran_int_t ldab)67 inline std::ptrdiff_t pbtrf( const UpLo, const fortran_int_t n,
68         const fortran_int_t kd, double* ab, const fortran_int_t ldab ) {
69     fortran_int_t info(0);
70     LAPACK_DPBTRF( &lapack_option< UpLo >::value, &n, &kd, ab, &ldab, &info );
71     return info;
72 }
73 
74 //
75 // Overloaded function for dispatching to
76 // * netlib-compatible LAPACK backend (the default), and
77 // * complex<float> value-type.
78 //
79 template< typename UpLo >
pbtrf(const UpLo,const fortran_int_t n,const fortran_int_t kd,std::complex<float> * ab,const fortran_int_t ldab)80 inline std::ptrdiff_t pbtrf( const UpLo, const fortran_int_t n,
81         const fortran_int_t kd, std::complex<float>* ab,
82         const fortran_int_t ldab ) {
83     fortran_int_t info(0);
84     LAPACK_CPBTRF( &lapack_option< UpLo >::value, &n, &kd, ab, &ldab, &info );
85     return info;
86 }
87 
88 //
89 // Overloaded function for dispatching to
90 // * netlib-compatible LAPACK backend (the default), and
91 // * complex<double> value-type.
92 //
93 template< typename UpLo >
pbtrf(const UpLo,const fortran_int_t n,const fortran_int_t kd,std::complex<double> * ab,const fortran_int_t ldab)94 inline std::ptrdiff_t pbtrf( const UpLo, const fortran_int_t n,
95         const fortran_int_t kd, std::complex<double>* ab,
96         const fortran_int_t ldab ) {
97     fortran_int_t info(0);
98     LAPACK_ZPBTRF( &lapack_option< UpLo >::value, &n, &kd, ab, &ldab, &info );
99     return info;
100 }
101 
102 } // namespace detail
103 
104 //
105 // Value-type based template class. Use this class if you need a type
106 // for dispatching to pbtrf.
107 //
108 template< typename Value >
109 struct pbtrf_impl {
110 
111     typedef Value value_type;
112     typedef typename remove_imaginary< Value >::type real_type;
113 
114     //
115     // Static member function, that
116     // * Deduces the required arguments for dispatching to LAPACK, and
117     // * Asserts that most arguments make sense.
118     //
119     template< typename MatrixAB >
invokeboost::numeric::bindings::lapack::pbtrf_impl120     static std::ptrdiff_t invoke( MatrixAB& ab ) {
121         namespace bindings = ::boost::numeric::bindings;
122         typedef typename result_of::uplo_tag< MatrixAB >::type uplo;
123         BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixAB >::value) );
124         BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAB >::value) );
125         BOOST_ASSERT( bindings::bandwidth(ab, uplo()) >= 0 );
126         BOOST_ASSERT( bindings::size_column(ab) >= 0 );
127         BOOST_ASSERT( bindings::size_minor(ab) == 1 ||
128                 bindings::stride_minor(ab) == 1 );
129         BOOST_ASSERT( bindings::stride_major(ab) >= bindings::bandwidth(ab,
130                 uplo())+1 );
131         return detail::pbtrf( uplo(), bindings::size_column(ab),
132                 bindings::bandwidth(ab, uplo()), bindings::begin_value(ab),
133                 bindings::stride_major(ab) );
134     }
135 
136 };
137 
138 
139 //
140 // Functions for direct use. These functions are overloaded for temporaries,
141 // so that wrapped types can still be passed and used for write-access. In
142 // addition, if applicable, they are overloaded for user-defined workspaces.
143 // Calls to these functions are passed to the pbtrf_impl classes. In the
144 // documentation, most overloads are collapsed to avoid a large number of
145 // prototypes which are very similar.
146 //
147 
148 //
149 // Overloaded function for pbtrf. Its overload differs for
150 //
151 template< typename MatrixAB >
pbtrf(MatrixAB & ab)152 inline std::ptrdiff_t pbtrf( MatrixAB& ab ) {
153     return pbtrf_impl< typename bindings::value_type<
154             MatrixAB >::type >::invoke( ab );
155 }
156 
157 } // namespace lapack
158 } // namespace bindings
159 } // namespace numeric
160 } // namespace boost
161 
162 #endif
163