00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef BOOST_NUMERIC_BINDINGS_LAPACK_PPSV_HPP
00016 #define BOOST_NUMERIC_BINDINGS_LAPACK_PPSV_HPP
00017
00018 #include <boost/numeric/bindings/traits/type_traits.hpp>
00019 #include <boost/numeric/bindings/traits/traits.hpp>
00020 #include <boost/numeric/bindings/lapack/lapack.h>
00021
00022 #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
00023 # include <boost/numeric/bindings/traits/detail/symm_herm_traits.hpp>
00024 # include <boost/static_assert.hpp>
00025 # include <boost/type_traits/is_same.hpp>
00026 #endif
00027
00028 #include <cassert>
00029
00030 namespace boost { namespace numeric { namespace bindings {
00031
00032 namespace lapack {
00033
00035
00036
00037
00038
00039
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 namespace detail {
00060
00061 inline
00062 void ppsv (char const uplo, int const n, int const nrhs,
00063 float* ap, float* b, int const ldb, int* info)
00064 {
00065 LAPACK_SPPSV (&uplo, &n, &nrhs, ap, b, &ldb, info);
00066 }
00067
00068 inline
00069 void ppsv (char const uplo, int const n, int const nrhs,
00070 double* ap, double* b, int const ldb, int* info)
00071 {
00072 LAPACK_DPPSV (&uplo, &n, &nrhs, ap, b, &ldb, info);
00073 }
00074
00075 inline
00076 void ppsv (char const uplo, int const n, int const nrhs,
00077 traits::complex_f* ap, traits::complex_f* b, int const ldb,
00078 int* info)
00079 {
00080 LAPACK_CPPSV (&uplo, &n, &nrhs,
00081 traits::complex_ptr (ap),
00082 traits::complex_ptr (b), &ldb, info);
00083 }
00084
00085 inline
00086 void ppsv (char const uplo, int const n, int const nrhs,
00087 traits::complex_d* ap, traits::complex_d* b, int const ldb,
00088 int* info)
00089 {
00090 LAPACK_ZPPSV (&uplo, &n, &nrhs,
00091 traits::complex_ptr (ap),
00092 traits::complex_ptr (b), &ldb, info);
00093 }
00094
00095 }
00096
00097 template <typename SymmMatrA, typename MatrB>
00098 inline
00099 int ppsv (SymmMatrA& a, MatrB& b) {
00100
00101 #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
00102 BOOST_STATIC_ASSERT((boost::is_same<
00103 typename traits::matrix_traits<SymmMatrA>::matrix_structure,
00104 typename traits::detail::symm_herm_pack_t<
00105 typename traits::matrix_traits<SymmMatrA>::value_type
00106 >::type
00107 >::value));
00108 BOOST_STATIC_ASSERT((boost::is_same<
00109 typename traits::matrix_traits<MatrB>::matrix_structure,
00110 traits::general_t
00111 >::value));
00112 #endif
00113
00114 int const n = traits::matrix_size1 (a);
00115 assert (n == traits::matrix_size2 (a));
00116 assert (n == traits::matrix_size1 (b));
00117
00118 char uplo = traits::matrix_uplo_tag (a);
00119 int info;
00120 detail::ppsv (uplo, n, traits::matrix_size2 (b),
00121 traits::matrix_storage (a),
00122 traits::matrix_storage (b),
00123 traits::leading_dimension (b),
00124 &info);
00125 return info;
00126 }
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138 namespace detail {
00139
00140 inline
00141 void pptrf (char const uplo, int const n, float* ap, int* info) {
00142 LAPACK_SPPTRF (&uplo, &n, ap, info);
00143 }
00144
00145 inline
00146 void pptrf (char const uplo, int const n, double* ap, int* info) {
00147 LAPACK_DPPTRF (&uplo, &n, ap, info);
00148 }
00149
00150 inline
00151 void pptrf (char const uplo, int const n,
00152 traits::complex_f* ap, int* info)
00153 {
00154 LAPACK_CPPTRF (&uplo, &n, traits::complex_ptr (ap), info);
00155 }
00156
00157 inline
00158 void pptrf (char const uplo, int const n,
00159 traits::complex_d* ap, int* info)
00160 {
00161 LAPACK_ZPPTRF (&uplo, &n, traits::complex_ptr (ap), info);
00162 }
00163
00164 }
00165
00166 template <typename SymmMatrA>
00167 inline
00168 int pptrf (SymmMatrA& a) {
00169
00170 #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
00171 BOOST_STATIC_ASSERT((boost::is_same<
00172 typename traits::matrix_traits<SymmMatrA>::matrix_structure,
00173 typename traits::detail::symm_herm_pack_t<
00174 typename traits::matrix_traits<SymmMatrA>::value_type
00175 >::type
00176 >::value));
00177 #endif
00178
00179 int const n = traits::matrix_size1 (a);
00180 assert (n == traits::matrix_size2 (a));
00181 char uplo = traits::matrix_uplo_tag (a);
00182 int info;
00183 detail::pptrf (uplo, n, traits::matrix_storage (a), &info);
00184 return info;
00185 }
00186
00187
00188
00189
00190
00191
00192
00193
00194 namespace detail {
00195
00196 inline
00197 void pptrs (char const uplo, int const n, int const nrhs,
00198 float const* ap, float* b, int const ldb, int* info)
00199 {
00200 LAPACK_SPPTRS (&uplo, &n, &nrhs, ap, b, &ldb, info);
00201 }
00202
00203 inline
00204 void pptrs (char const uplo, int const n, int const nrhs,
00205 double const* ap, double* b, int const ldb, int* info)
00206 {
00207 LAPACK_DPPTRS (&uplo, &n, &nrhs, ap, b, &ldb, info);
00208 }
00209
00210 inline
00211 void pptrs (char const uplo, int const n, int const nrhs,
00212 traits::complex_f const* ap,
00213 traits::complex_f* b, int const ldb, int* info)
00214 {
00215 LAPACK_CPPTRS (&uplo, &n, &nrhs,
00216 traits::complex_ptr (ap),
00217 traits::complex_ptr (b), &ldb, info);
00218 }
00219
00220 inline
00221 void pptrs (char const uplo, int const n, int const nrhs,
00222 traits::complex_d const* ap,
00223 traits::complex_d* b, int const ldb, int* info)
00224 {
00225 LAPACK_ZPPTRS (&uplo, &n, &nrhs,
00226 traits::complex_ptr (ap),
00227 traits::complex_ptr (b), &ldb, info);
00228 }
00229
00230 }
00231
00232 template <typename SymmMatrA, typename MatrB>
00233 inline
00234 int pptrs (SymmMatrA const& a, MatrB& b) {
00235
00236 #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
00237 BOOST_STATIC_ASSERT((boost::is_same<
00238 typename traits::matrix_traits<SymmMatrA>::matrix_structure,
00239 typename traits::detail::symm_herm_pack_t<
00240 typename traits::matrix_traits<SymmMatrA>::value_type
00241 >::type
00242 >::value));
00243 BOOST_STATIC_ASSERT((boost::is_same<
00244 typename traits::matrix_traits<MatrB>::matrix_structure,
00245 traits::general_t
00246 >::value));
00247 #endif
00248
00249 int const n = traits::matrix_size1 (a);
00250 assert (n == traits::matrix_size2 (a));
00251 assert (n == traits::matrix_size1 (b));
00252
00253 char uplo = traits::matrix_uplo_tag (a);
00254 int info;
00255 detail::pptrs (uplo, n, traits::matrix_size2 (b),
00256 #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
00257 traits::matrix_storage (a),
00258 #else
00259 traits::matrix_storage_const (a),
00260 #endif
00261 traits::matrix_storage (b),
00262 traits::leading_dimension (b),
00263 &info);
00264 return info;
00265 }
00266
00267
00268
00269
00270
00271
00272
00273
00274 namespace detail {
00275
00276 inline
00277 void pptri (char const uplo, int const n, float* ap, int* info) {
00278 LAPACK_SPPTRI (&uplo, &n, ap, info);
00279 }
00280
00281 inline
00282 void pptri (char const uplo, int const n, double* ap, int* info) {
00283 LAPACK_DPPTRI (&uplo, &n, ap, info);
00284 }
00285
00286 inline
00287 void pptri (char const uplo, int const n,
00288 traits::complex_f* ap, int* info)
00289 {
00290 LAPACK_CPPTRI (&uplo, &n, traits::complex_ptr (ap), info);
00291 }
00292
00293 inline
00294 void pptri (char const uplo, int const n,
00295 traits::complex_d* ap, int* info)
00296 {
00297 LAPACK_ZPPTRI(&uplo, &n, traits::complex_ptr (ap), info);
00298 }
00299
00300 }
00301
00302 template <typename SymmMatrA>
00303 inline
00304 int pptri (SymmMatrA& a) {
00305
00306 #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
00307 BOOST_STATIC_ASSERT((boost::is_same<
00308 typename traits::matrix_traits<SymmMatrA>::matrix_structure,
00309 typename traits::detail::symm_herm_pack_t<
00310 typename traits::matrix_traits<SymmMatrA>::value_type
00311 >::type
00312 >::value));
00313 #endif
00314
00315 int const n = traits::matrix_size1 (a);
00316 assert (n == traits::matrix_size2 (a));
00317 char uplo = traits::matrix_uplo_tag (a);
00318 int info;
00319 detail::pptri (uplo, n, traits::matrix_storage (a), &info);
00320 return info;
00321 }
00322
00323
00324 }
00325
00326 }}}
00327
00328 #endif