00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef BOOST_NUMERIC_BINDINGS_CLAPACK_OVERLOADS_HPP
00015 #define BOOST_NUMERIC_BINDINGS_CLAPACK_OVERLOADS_HPP
00016
00017 #include <boost/numeric/bindings/atlas/clapack_inc.hpp>
00018 #include <boost/numeric/bindings/traits/type.hpp>
00019
00020
00021 namespace boost { namespace numeric { namespace bindings {
00022
00023 namespace atlas { namespace detail {
00024
00025
00026
00027
00028
00029
00030 inline
00031 int gesv (CBLAS_ORDER const Order,
00032 int const N, int const NRHS,
00033 float* A, int const lda, int* ipiv,
00034 float* B, int const ldb)
00035 {
00036 return clapack_sgesv (Order, N, NRHS, A, lda, ipiv, B, ldb);
00037 }
00038
00039 inline
00040 int gesv (CBLAS_ORDER const Order,
00041 int const N, int const NRHS,
00042 double* A, int const lda, int* ipiv,
00043 double* B, int const ldb)
00044 {
00045 return clapack_dgesv (Order, N, NRHS, A, lda, ipiv, B, ldb);
00046 }
00047
00048 inline
00049 int gesv (CBLAS_ORDER const Order,
00050 int const N, int const NRHS,
00051 traits::complex_f* A, int const lda, int* ipiv,
00052 traits::complex_f* B, int const ldb)
00053 {
00054 return clapack_cgesv (Order, N, NRHS,
00055 static_cast<void*> (A), lda, ipiv,
00056 static_cast<void*> (B), ldb);
00057 }
00058
00059 inline
00060 int gesv (CBLAS_ORDER const Order,
00061 int const N, int const NRHS,
00062 traits::complex_d* A, int const lda, int* ipiv,
00063 traits::complex_d* B, int const ldb)
00064 {
00065 return clapack_zgesv (Order, N, NRHS,
00066 static_cast<void*> (A), lda, ipiv,
00067 static_cast<void*> (B), ldb);
00068 }
00069
00070
00071 inline
00072 int getrf (CBLAS_ORDER const Order,
00073 int const M, int const N,
00074 float* A, int const lda, int* ipiv)
00075 {
00076 return clapack_sgetrf (Order, M, N, A, lda, ipiv);
00077 }
00078
00079 inline
00080 int getrf (CBLAS_ORDER const Order,
00081 int const M, int const N,
00082 double* A, int const lda, int* ipiv)
00083 {
00084 return clapack_dgetrf (Order, M, N, A, lda, ipiv);
00085 }
00086
00087 inline
00088 int getrf (CBLAS_ORDER const Order,
00089 int const M, int const N,
00090 traits::complex_f* A, int const lda, int* ipiv)
00091 {
00092 return clapack_cgetrf (Order, M, N, static_cast<void*> (A), lda, ipiv);
00093 }
00094
00095 inline
00096 int getrf (CBLAS_ORDER const Order,
00097 int const M, int const N,
00098 traits::complex_d* A, int const lda, int* ipiv)
00099 {
00100 return clapack_zgetrf (Order, M, N, static_cast<void*> (A), lda, ipiv);
00101 }
00102
00103
00104 inline
00105 int getrs (CBLAS_ORDER const Order, CBLAS_TRANSPOSE const Trans,
00106 int const N, int const NRHS,
00107 float const* A, int const lda, int const* ipiv,
00108 float* B, int const ldb)
00109 {
00110 return clapack_sgetrs (Order, Trans, N, NRHS, A, lda, ipiv, B, ldb);
00111 }
00112
00113 inline
00114 int getrs (CBLAS_ORDER const Order, CBLAS_TRANSPOSE const Trans,
00115 int const N, int const NRHS,
00116 double const* A, int const lda, int const* ipiv,
00117 double* B, int const ldb)
00118 {
00119 return clapack_dgetrs (Order, Trans, N, NRHS, A, lda, ipiv, B, ldb);
00120 }
00121
00122 inline
00123 int getrs (CBLAS_ORDER const Order, CBLAS_TRANSPOSE const Trans,
00124 int const N, int const NRHS,
00125 traits::complex_f const* A, int const lda,
00126 int const* ipiv,
00127 traits::complex_f* B, int const ldb)
00128 {
00129 return clapack_cgetrs (Order, Trans, N, NRHS,
00130 static_cast<void const*> (A), lda, ipiv,
00131 static_cast<void*> (B), ldb);
00132 }
00133
00134 inline
00135 int getrs (CBLAS_ORDER const Order, CBLAS_TRANSPOSE const Trans,
00136 int const N, int const NRHS,
00137 traits::complex_d const* A, int const lda,
00138 int const* ipiv,
00139 traits::complex_d* B, int const ldb)
00140 {
00141 return clapack_zgetrs (Order, Trans, N, NRHS,
00142 static_cast<void const*> (A), lda, ipiv,
00143 static_cast<void*> (B), ldb);
00144 }
00145
00146
00147 inline
00148 int getri (CBLAS_ORDER const Order,
00149 int const N, float* A, int const lda,
00150 int const* ipiv)
00151 {
00152 return clapack_sgetri (Order, N, A, lda, ipiv);
00153 }
00154
00155 inline
00156 int getri (CBLAS_ORDER const Order,
00157 int const N, double* A, int const lda,
00158 int const* ipiv)
00159 {
00160 return clapack_dgetri (Order, N, A, lda, ipiv);
00161 }
00162
00163 inline
00164 int getri (CBLAS_ORDER const Order,
00165 int const N, traits::complex_f* A, int const lda,
00166 int const* ipiv)
00167 {
00168 return clapack_cgetri (Order, N, static_cast<void*> (A), lda, ipiv);
00169 }
00170
00171 inline
00172 int getri (CBLAS_ORDER const Order,
00173 int const N, traits::complex_d* A, int const lda,
00174 int const* ipiv)
00175 {
00176 return clapack_zgetri (Order, N, static_cast<void*> (A), lda, ipiv);
00177 }
00178
00179
00180
00181
00182
00183
00184
00185
00186 inline
00187 int posv (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00188 int const N, int const NRHS,
00189 float* A, int const lda, float* B, int const ldb)
00190 {
00191 return clapack_sposv (Order, Uplo, N, NRHS, A, lda, B, ldb);
00192 }
00193
00194 inline
00195 int posv (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00196 int const N, int const NRHS,
00197 double* A, int const lda, double* B, int const ldb)
00198 {
00199 return clapack_dposv (Order, Uplo, N, NRHS, A, lda, B, ldb);
00200 }
00201
00202 inline
00203 int posv (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00204 int const N, int const NRHS,
00205 traits::complex_f* A, int const lda,
00206 traits::complex_f* B, int const ldb)
00207 {
00208 return clapack_cposv (Order, Uplo, N, NRHS,
00209 static_cast<void*> (A), lda,
00210 static_cast<void*> (B), ldb);
00211 }
00212
00213 inline
00214 int posv (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00215 int const N, int const NRHS,
00216 traits::complex_d* A, int const lda,
00217 traits::complex_d* B, int const ldb)
00218 {
00219 return clapack_zposv (Order, Uplo, N, NRHS,
00220 static_cast<void*> (A), lda,
00221 static_cast<void*> (B), ldb);
00222 }
00223
00224
00225 inline
00226 int potrf (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00227 int const N, float* A, int const lda)
00228 {
00229 return clapack_spotrf (Order, Uplo, N, A, lda);
00230 }
00231
00232 inline
00233 int potrf (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00234 int const N, double* A, int const lda)
00235 {
00236 return clapack_dpotrf (Order, Uplo, N, A, lda);
00237 }
00238
00239 inline
00240 int potrf (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00241 int const N, traits::complex_f* A, int const lda)
00242 {
00243 return clapack_cpotrf (Order, Uplo, N, static_cast<void*> (A), lda);
00244 }
00245
00246 inline
00247 int potrf (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00248 int const N, traits::complex_d* A, int const lda)
00249 {
00250 return clapack_zpotrf (Order, Uplo, N, static_cast<void*> (A), lda);
00251 }
00252
00253
00254 inline
00255 int potrs (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00256 int const N, int const NRHS,
00257 float const* A, int const lda, float* B, int const ldb)
00258 {
00259 return clapack_spotrs (Order, Uplo, N, NRHS, A, lda, B, ldb);
00260 }
00261
00262 inline
00263 int potrs (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00264 int const N, int const NRHS,
00265 double const* A, int const lda, double* B, int const ldb)
00266 {
00267 return clapack_dpotrs (Order, Uplo, N, NRHS, A, lda, B, ldb);
00268 }
00269
00270 inline
00271 int potrs (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00272 int const N, int const NRHS,
00273 traits::complex_f const* A, int const lda,
00274 traits::complex_f* B, int const ldb)
00275 {
00276 return clapack_cpotrs (Order, Uplo, N, NRHS,
00277 static_cast<void const*> (A), lda,
00278 static_cast<void*> (B), ldb);
00279 }
00280
00281 inline
00282 int potrs (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00283 int const N, int const NRHS,
00284 traits::complex_d const* A, int const lda,
00285 traits::complex_d* B, int const ldb)
00286 {
00287 return clapack_zpotrs (Order, Uplo, N, NRHS,
00288 static_cast<void const*> (A), lda,
00289 static_cast<void*> (B), ldb);
00290 }
00291
00292 #ifdef BOOST_NUMERIC_BINDINGS_ATLAS_POTRF_BUG
00293
00294
00295 inline
00296 int potrs_bug (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00297 int const N, int const NRHS,
00298 float const* A, int const lda, float* B, int const ldb)
00299 {
00300 return clapack_spotrs (Order, Uplo, N, NRHS, A, lda, B, ldb);
00301 }
00302
00303 inline
00304 int potrs_bug (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00305 int const N, int const NRHS,
00306 double const* A, int const lda, double* B, int const ldb)
00307 {
00308 return clapack_dpotrs (Order, Uplo, N, NRHS, A, lda, B, ldb);
00309 }
00310
00311 inline
00312 int potrs_bug (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00313 int const N, int const NRHS,
00314 traits::complex_f const* A, int const lda,
00315 traits::complex_f* B, int const ldb)
00316 {
00317 int sz = N * lda;
00318 traits::complex_f* A1 = new traits::complex_f[sz];
00319 for (int i = 0; i < sz; ++i)
00320 A1[i] = std::conj (A[i]);
00321 int r = clapack_cpotrs (Order, Uplo, N, NRHS,
00322 static_cast<void const*> (A1), lda,
00323 static_cast<void*> (B), ldb);
00324 delete[] A1;
00325 return r;
00326 }
00327
00328 inline
00329 int potrs_bug (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00330 int const N, int const NRHS,
00331 traits::complex_d const* A, int const lda,
00332 traits::complex_d* B, int const ldb)
00333 {
00334 int sz = N * lda;
00335 traits::complex_d* A1 = new traits::complex_d[sz];
00336 for (int i = 0; i < sz; ++i)
00337 A1[i] = std::conj (A[i]);
00338 int r = clapack_zpotrs (Order, Uplo, N, NRHS,
00339 static_cast<void const*> (A1), lda,
00340 static_cast<void*> (B), ldb);
00341 delete[] A1;
00342 return r;
00343 }
00344 #endif // BOOST_NUMERIC_BINDINGS_ATLAS_POTRF_BUG
00345
00346
00347 inline
00348 int potri (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00349 int const N, float* A, int const lda)
00350 {
00351 return clapack_spotri (Order, Uplo, N, A, lda);
00352 }
00353
00354 inline
00355 int potri (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00356 int const N, double* A, int const lda)
00357 {
00358 return clapack_dpotri (Order, Uplo, N, A, lda);
00359 }
00360
00361 inline
00362 int potri (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00363 int const N, traits::complex_f* A, int const lda)
00364 {
00365 return clapack_cpotri (Order, Uplo, N, static_cast<void*> (A), lda);
00366 }
00367
00368 inline
00369 int potri (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00370 int const N, traits::complex_d* A, int const lda)
00371 {
00372 return clapack_zpotri (Order, Uplo, N, static_cast<void*> (A), lda);
00373 }
00374
00375
00376 }}
00377
00378 }}}
00379
00380
00381 #endif // BOOST_NUMERIC_BINDINGS_CLAPACK_OVERLOADS_HPP