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_PBTRS_HPP
15 #define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_PBTRS_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 pbtrs 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 >
pbtrs(const UpLo,const fortran_int_t n,const fortran_int_t kd,const fortran_int_t nrhs,const float * ab,const fortran_int_t ldab,float * b,const fortran_int_t ldb)54 inline std::ptrdiff_t pbtrs( const UpLo, const fortran_int_t n,
55 const fortran_int_t kd, const fortran_int_t nrhs, const float* ab,
56 const fortran_int_t ldab, float* b, const fortran_int_t ldb ) {
57 fortran_int_t info(0);
58 LAPACK_SPBTRS( &lapack_option< UpLo >::value, &n, &kd, &nrhs, ab, &ldab,
59 b, &ldb, &info );
60 return info;
61 }
62
63 //
64 // Overloaded function for dispatching to
65 // * netlib-compatible LAPACK backend (the default), and
66 // * double value-type.
67 //
68 template< typename UpLo >
pbtrs(const UpLo,const fortran_int_t n,const fortran_int_t kd,const fortran_int_t nrhs,const double * ab,const fortran_int_t ldab,double * b,const fortran_int_t ldb)69 inline std::ptrdiff_t pbtrs( const UpLo, const fortran_int_t n,
70 const fortran_int_t kd, const fortran_int_t nrhs, const double* ab,
71 const fortran_int_t ldab, double* b, const fortran_int_t ldb ) {
72 fortran_int_t info(0);
73 LAPACK_DPBTRS( &lapack_option< UpLo >::value, &n, &kd, &nrhs, ab, &ldab,
74 b, &ldb, &info );
75 return info;
76 }
77
78 //
79 // Overloaded function for dispatching to
80 // * netlib-compatible LAPACK backend (the default), and
81 // * complex<float> value-type.
82 //
83 template< typename UpLo >
pbtrs(const UpLo,const fortran_int_t n,const fortran_int_t kd,const fortran_int_t nrhs,const std::complex<float> * ab,const fortran_int_t ldab,std::complex<float> * b,const fortran_int_t ldb)84 inline std::ptrdiff_t pbtrs( const UpLo, const fortran_int_t n,
85 const fortran_int_t kd, const fortran_int_t nrhs,
86 const std::complex<float>* ab, const fortran_int_t ldab,
87 std::complex<float>* b, const fortran_int_t ldb ) {
88 fortran_int_t info(0);
89 LAPACK_CPBTRS( &lapack_option< UpLo >::value, &n, &kd, &nrhs, ab, &ldab,
90 b, &ldb, &info );
91 return info;
92 }
93
94 //
95 // Overloaded function for dispatching to
96 // * netlib-compatible LAPACK backend (the default), and
97 // * complex<double> value-type.
98 //
99 template< typename UpLo >
pbtrs(const UpLo,const fortran_int_t n,const fortran_int_t kd,const fortran_int_t nrhs,const std::complex<double> * ab,const fortran_int_t ldab,std::complex<double> * b,const fortran_int_t ldb)100 inline std::ptrdiff_t pbtrs( const UpLo, const fortran_int_t n,
101 const fortran_int_t kd, const fortran_int_t nrhs,
102 const std::complex<double>* ab, const fortran_int_t ldab,
103 std::complex<double>* b, const fortran_int_t ldb ) {
104 fortran_int_t info(0);
105 LAPACK_ZPBTRS( &lapack_option< UpLo >::value, &n, &kd, &nrhs, ab, &ldab,
106 b, &ldb, &info );
107 return info;
108 }
109
110 } // namespace detail
111
112 //
113 // Value-type based template class. Use this class if you need a type
114 // for dispatching to pbtrs.
115 //
116 template< typename Value >
117 struct pbtrs_impl {
118
119 typedef Value value_type;
120 typedef typename remove_imaginary< Value >::type real_type;
121
122 //
123 // Static member function, that
124 // * Deduces the required arguments for dispatching to LAPACK, and
125 // * Asserts that most arguments make sense.
126 //
127 template< typename MatrixAB, typename MatrixB >
invokeboost::numeric::bindings::lapack::pbtrs_impl128 static std::ptrdiff_t invoke( const MatrixAB& ab, MatrixB& b ) {
129 namespace bindings = ::boost::numeric::bindings;
130 typedef typename result_of::uplo_tag< MatrixAB >::type uplo;
131 BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixAB >::value) );
132 BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
133 BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
134 typename bindings::value_type< MatrixAB >::type >::type,
135 typename remove_const< typename bindings::value_type<
136 MatrixB >::type >::type >::value) );
137 BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixB >::value) );
138 BOOST_ASSERT( bindings::bandwidth(ab, uplo()) >= 0 );
139 BOOST_ASSERT( bindings::size_column(ab) >= 0 );
140 BOOST_ASSERT( bindings::size_column(b) >= 0 );
141 BOOST_ASSERT( bindings::size_minor(ab) == 1 ||
142 bindings::stride_minor(ab) == 1 );
143 BOOST_ASSERT( bindings::size_minor(b) == 1 ||
144 bindings::stride_minor(b) == 1 );
145 BOOST_ASSERT( bindings::stride_major(ab) >= bindings::bandwidth(ab,
146 uplo())+1 );
147 BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
148 bindings::size_column(ab)) );
149 return detail::pbtrs( uplo(), bindings::size_column(ab),
150 bindings::bandwidth(ab, uplo()), bindings::size_column(b),
151 bindings::begin_value(ab), bindings::stride_major(ab),
152 bindings::begin_value(b), bindings::stride_major(b) );
153 }
154
155 };
156
157
158 //
159 // Functions for direct use. These functions are overloaded for temporaries,
160 // so that wrapped types can still be passed and used for write-access. In
161 // addition, if applicable, they are overloaded for user-defined workspaces.
162 // Calls to these functions are passed to the pbtrs_impl classes. In the
163 // documentation, most overloads are collapsed to avoid a large number of
164 // prototypes which are very similar.
165 //
166
167 //
168 // Overloaded function for pbtrs. Its overload differs for
169 //
170 template< typename MatrixAB, typename MatrixB >
pbtrs(const MatrixAB & ab,MatrixB & b)171 inline std::ptrdiff_t pbtrs( const MatrixAB& ab, MatrixB& b ) {
172 return pbtrs_impl< typename bindings::value_type<
173 MatrixAB >::type >::invoke( ab, b );
174 }
175
176 } // namespace lapack
177 } // namespace bindings
178 } // namespace numeric
179 } // namespace boost
180
181 #endif
182