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_AUXILIARY_LANHP_HPP
15 #define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LANHP_HPP
16
17 #include <boost/assert.hpp>
18 #include <boost/numeric/bindings/begin.hpp>
19 #include <boost/numeric/bindings/detail/array.hpp>
20 #include <boost/numeric/bindings/is_mutable.hpp>
21 #include <boost/numeric/bindings/lapack/workspace.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 lanhp 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 // * complex<float> value-type.
52 //
53 template< typename UpLo >
lanhp(const char norm,const UpLo,const fortran_int_t n,const std::complex<float> * ap,float * work)54 inline std::ptrdiff_t lanhp( const char norm, const UpLo,
55 const fortran_int_t n, const std::complex<float>* ap, float* work ) {
56 fortran_int_t info(0);
57 LAPACK_CLANHP( &norm, &lapack_option< UpLo >::value, &n, ap, work );
58 return info;
59 }
60
61 //
62 // Overloaded function for dispatching to
63 // * netlib-compatible LAPACK backend (the default), and
64 // * complex<double> value-type.
65 //
66 template< typename UpLo >
lanhp(const char norm,const UpLo,const fortran_int_t n,const std::complex<double> * ap,double * work)67 inline std::ptrdiff_t lanhp( const char norm, const UpLo,
68 const fortran_int_t n, const std::complex<double>* ap, double* work ) {
69 fortran_int_t info(0);
70 LAPACK_ZLANHP( &norm, &lapack_option< UpLo >::value, &n, ap, work );
71 return info;
72 }
73
74 } // namespace detail
75
76 //
77 // Value-type based template class. Use this class if you need a type
78 // for dispatching to lanhp.
79 //
80 template< typename Value >
81 struct lanhp_impl {
82
83 typedef Value value_type;
84 typedef typename remove_imaginary< Value >::type real_type;
85
86 //
87 // Static member function for user-defined workspaces, that
88 // * Deduces the required arguments for dispatching to LAPACK, and
89 // * Asserts that most arguments make sense.
90 //
91 template< typename MatrixAP, typename WORK >
invokeboost::numeric::bindings::lapack::lanhp_impl92 static std::ptrdiff_t invoke( const char norm, const MatrixAP& ap,
93 detail::workspace1< WORK > work ) {
94 namespace bindings = ::boost::numeric::bindings;
95 typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
96 BOOST_ASSERT( bindings::size(work.select(real_type())) >=
97 min_size_work( norm, bindings::size_column(ap) ));
98 BOOST_ASSERT( bindings::size_column(ap) >= 0 );
99 return detail::lanhp( norm, uplo(), bindings::size_column(ap),
100 bindings::begin_value(ap),
101 bindings::begin_value(work.select(real_type())) );
102 }
103
104 //
105 // Static member function that
106 // * Figures out the minimal workspace requirements, and passes
107 // the results to the user-defined workspace overload of the
108 // invoke static member function
109 // * Enables the unblocked algorithm (BLAS level 2)
110 //
111 template< typename MatrixAP >
invokeboost::numeric::bindings::lapack::lanhp_impl112 static std::ptrdiff_t invoke( const char norm, const MatrixAP& ap,
113 minimal_workspace ) {
114 namespace bindings = ::boost::numeric::bindings;
115 typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
116 bindings::detail::array< real_type > tmp_work( min_size_work( norm,
117 bindings::size_column(ap) ) );
118 return invoke( norm, ap, workspace( tmp_work ) );
119 }
120
121 //
122 // Static member function that
123 // * Figures out the optimal workspace requirements, and passes
124 // the results to the user-defined workspace overload of the
125 // invoke static member
126 // * Enables the blocked algorithm (BLAS level 3)
127 //
128 template< typename MatrixAP >
invokeboost::numeric::bindings::lapack::lanhp_impl129 static std::ptrdiff_t invoke( const char norm, const MatrixAP& ap,
130 optimal_workspace ) {
131 namespace bindings = ::boost::numeric::bindings;
132 typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
133 return invoke( norm, ap, minimal_workspace() );
134 }
135
136 //
137 // Static member function that returns the minimum size of
138 // workspace-array work.
139 //
min_size_workboost::numeric::bindings::lapack::lanhp_impl140 static std::ptrdiff_t min_size_work( const char norm,
141 const std::ptrdiff_t n ) {
142 if ( norm == 'I' || norm == '1' || norm == 'O' )
143 return std::max< std::ptrdiff_t >( 1, n );
144 else
145 return 1;
146 }
147 };
148
149
150 //
151 // Functions for direct use. These functions are overloaded for temporaries,
152 // so that wrapped types can still be passed and used for write-access. In
153 // addition, if applicable, they are overloaded for user-defined workspaces.
154 // Calls to these functions are passed to the lanhp_impl classes. In the
155 // documentation, most overloads are collapsed to avoid a large number of
156 // prototypes which are very similar.
157 //
158
159 //
160 // Overloaded function for lanhp. Its overload differs for
161 // * User-defined workspace
162 //
163 template< typename MatrixAP, typename Workspace >
164 inline typename boost::enable_if< detail::is_workspace< Workspace >,
165 std::ptrdiff_t >::type
lanhp(const char norm,const MatrixAP & ap,Workspace work)166 lanhp( const char norm, const MatrixAP& ap, Workspace work ) {
167 return lanhp_impl< typename bindings::value_type<
168 MatrixAP >::type >::invoke( norm, ap, work );
169 }
170
171 //
172 // Overloaded function for lanhp. Its overload differs for
173 // * Default workspace-type (optimal)
174 //
175 template< typename MatrixAP >
176 inline typename boost::disable_if< detail::is_workspace< MatrixAP >,
177 std::ptrdiff_t >::type
lanhp(const char norm,const MatrixAP & ap)178 lanhp( const char norm, const MatrixAP& ap ) {
179 return lanhp_impl< typename bindings::value_type<
180 MatrixAP >::type >::invoke( norm, ap, optimal_workspace() );
181 }
182
183 } // namespace lapack
184 } // namespace bindings
185 } // namespace numeric
186 } // namespace boost
187
188 #endif
189