cblas2_overloads.hpp

Go to the documentation of this file.
00001 /*
00002  * 
00003  * Copyright (c) Kresimir Fresl 2002, 2003
00004  *
00005  * Distributed under the Boost Software License, Version 1.0.
00006  * (See accompanying file LICENSE_1_0.txt or copy at
00007  * http://www.boost.org/LICENSE_1_0.txt)
00008  *
00009  * Author acknowledges the support of the Faculty of Civil Engineering, 
00010  * University of Zagreb, Croatia.
00011  *
00012  */
00013 
00014 #ifndef BOOST_NUMERIC_BINDINGS_CBLAS2_OVERLOADS_HPP
00015 #define BOOST_NUMERIC_BINDINGS_CBLAS2_OVERLOADS_HPP
00016 
00017 #include <complex> 
00018 #include <boost/numeric/bindings/atlas/cblas_inc.hpp>
00019 #include <boost/numeric/bindings/traits/type.hpp>
00020 
00021 
00022 namespace boost { namespace numeric { namespace bindings { 
00023 
00024   namespace atlas { namespace detail {
00025 
00026 
00027     // y <- alpha * op (A) * x + beta * y
00028 
00029     inline 
00030     void gemv (CBLAS_ORDER const Order, 
00031                CBLAS_TRANSPOSE const TransA, int const M, int const N,
00032                float const alpha, float const* A, int const lda,
00033                float const* X, int const incX, 
00034                float const beta, float* Y, int const incY) 
00035     {
00036       cblas_sgemv (Order, TransA, M, N, alpha, A, lda, 
00037                    X, incX,
00038                    beta, Y, incY); 
00039     }
00040     
00041     inline 
00042     void gemv (CBLAS_ORDER const Order, 
00043                CBLAS_TRANSPOSE const TransA, int const M, int const N,
00044                double const alpha, double const* A, int const lda,
00045                double const* X, int const incX, 
00046                double const beta, double* Y, int const incY) 
00047     {
00048       cblas_dgemv (Order, TransA, M, N, alpha, A, lda, 
00049                    X, incX,
00050                    beta, Y, incY); 
00051     }
00052     
00053     inline 
00054     void gemv (CBLAS_ORDER const Order, 
00055                CBLAS_TRANSPOSE const TransA, int const M, int const N,
00056                traits::complex_f const& alpha, 
00057                traits::complex_f const* A, int const lda,
00058                traits::complex_f const* X, int const incX, 
00059                traits::complex_f const& beta, 
00060                traits::complex_f* Y, int const incY) 
00061     {
00062       cblas_cgemv (Order, TransA, M, N, 
00063                    static_cast<void const*> (&alpha), 
00064                    static_cast<void const*> (A), lda, 
00065                    static_cast<void const*> (X), incX,
00066                    static_cast<void const*> (&beta), 
00067                    static_cast<void*> (Y), incY); 
00068     }
00069     
00070     inline 
00071     void gemv (CBLAS_ORDER const Order, 
00072                CBLAS_TRANSPOSE const TransA, int const M, int const N,
00073                traits::complex_d const& alpha, 
00074                traits::complex_d const* A, int const lda,
00075                traits::complex_d const* X, int const incX, 
00076                traits::complex_d const& beta, 
00077                traits::complex_d* Y, int const incY) 
00078     {
00079       cblas_zgemv (Order, TransA, M, N, 
00080                    static_cast<void const*> (&alpha), 
00081                    static_cast<void const*> (A), lda, 
00082                    static_cast<void const*> (X), incX,
00083                    static_cast<void const*> (&beta), 
00084                    static_cast<void*> (Y), incY); 
00085     }
00086 
00087 
00088     // y <- alpha * A * x + beta * y
00089     // A real symmetric
00090 
00091     inline 
00092     void symv (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00093                int const N, float const alpha, float const* A,
00094                int const lda, float const* X, int const incX,
00095                float const beta, float* Y, int const incY) 
00096     {
00097       cblas_ssymv (Order, Uplo, N, alpha, A, lda, 
00098                    X, incX, beta, Y, incY);
00099     }
00100 
00101     inline 
00102     void symv (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00103                int const N, double const alpha, double const* A,
00104                int const lda, double const* X, int const incX,
00105                double const beta, double* Y, int const incY) 
00106     {
00107       cblas_dsymv (Order, Uplo, N, alpha, A, lda, 
00108                    X, incX, beta, Y, incY);
00109     }
00110 
00111 
00112     // y <- alpha * A * x + beta * y
00113     // A real symmetric in packed form 
00114 
00115     inline
00116     void spmv (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00117                int const N, float const alpha, float const* Ap,
00118                float const* X, int const incX,
00119                float const beta, float* Y, int const incY) 
00120     {
00121       cblas_sspmv (Order, Uplo, N, alpha, Ap, X, incX, beta, Y, incY);
00122     }
00123 
00124     inline
00125     void spmv (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00126                int const N, double const alpha, double const* Ap,
00127                double const* X, int const incX,
00128                double const beta, double* Y, int const incY) 
00129     {
00130       cblas_dspmv (Order, Uplo, N, alpha, Ap, X, incX, beta, Y, incY);
00131     }
00132 
00133 
00134     // y <- alpha * A * x + beta * y
00135     // A complex hermitian 
00136 
00137     inline 
00138     void hemv (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00139                int const N, traits::complex_f const& alpha, 
00140                traits::complex_f const* A, int const lda, 
00141                traits::complex_f const* X, int const incX,
00142                traits::complex_f const& beta, 
00143                traits::complex_f* Y, int const incY) 
00144     {
00145       cblas_chemv (Order, Uplo, N, 
00146                    static_cast<void const*> (&alpha), 
00147                    static_cast<void const*> (A), lda, 
00148                    static_cast<void const*> (X), incX, 
00149                    static_cast<void const*> (&beta), 
00150                    static_cast<void*> (Y), incY);
00151     }
00152 
00153     inline 
00154     void hemv (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00155                int const N, traits::complex_d const& alpha, 
00156                traits::complex_d const* A, int const lda, 
00157                traits::complex_d const* X, int const incX,
00158                traits::complex_d const& beta, 
00159                traits::complex_d* Y, int const incY) 
00160     {
00161       cblas_zhemv (Order, Uplo, N, 
00162                    static_cast<void const*> (&alpha), 
00163                    static_cast<void const*> (A), lda, 
00164                    static_cast<void const*> (X), incX, 
00165                    static_cast<void const*> (&beta), 
00166                    static_cast<void*> (Y), incY);
00167     }
00168 
00169 
00170     // y <- alpha * A * x + beta * y
00171     // A complex hermitian in packed form 
00172 
00173     inline 
00174     void hpmv (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00175                int const N, traits::complex_f const& alpha, 
00176                traits::complex_f const* Ap, 
00177                traits::complex_f const* X, int const incX,
00178                traits::complex_f const& beta, 
00179                traits::complex_f* Y, int const incY) 
00180     {
00181       cblas_chpmv (Order, Uplo, N, 
00182                    static_cast<void const*> (&alpha), 
00183                    static_cast<void const*> (Ap), 
00184                    static_cast<void const*> (X), incX, 
00185                    static_cast<void const*> (&beta), 
00186                    static_cast<void*> (Y), incY);
00187     }
00188 
00189     inline 
00190     void hpmv (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00191                int const N, traits::complex_d const& alpha, 
00192                traits::complex_d const* Ap, 
00193                traits::complex_d const* X, int const incX,
00194                traits::complex_d const& beta, 
00195                traits::complex_d* Y, int const incY) 
00196     {
00197       cblas_zhpmv (Order, Uplo, N, 
00198                    static_cast<void const*> (&alpha), 
00199                    static_cast<void const*> (Ap), 
00200                    static_cast<void const*> (X), incX, 
00201                    static_cast<void const*> (&beta), 
00202                    static_cast<void*> (Y), incY);
00203     }
00204 
00205 
00206     // A <- alpha * x * y^T + A 
00207     // .. real types:    calls cblas_xger
00208     // .. complex types: calls cblas_xgeru
00209 
00210     inline 
00211     void ger (CBLAS_ORDER const Order, int const M, int const N,
00212               float const alpha, float const* X, int const incX,
00213               float const* Y, int const incY, float* A, int const lda)
00214     {
00215       cblas_sger (Order, M, N, alpha, X, incX, Y, incY, A, lda); 
00216     }
00217 
00218     inline 
00219     void ger (CBLAS_ORDER const Order, int const M, int const N,
00220               double const alpha, double const* X, int const incX,
00221               double const* Y, int const incY, double* A, int const lda)
00222     {
00223       cblas_dger (Order, M, N, alpha, X, incX, Y, incY, A, lda); 
00224     }
00225 
00226     inline 
00227     void ger (CBLAS_ORDER const Order, int const M, int const N,
00228               traits::complex_f const& alpha, 
00229               traits::complex_f const* X, int const incX,
00230               traits::complex_f const* Y, int const incY, 
00231               traits::complex_f* A, int const lda)
00232     {
00233       cblas_cgeru (Order, M, N, 
00234                    static_cast<void const*> (&alpha), 
00235                    static_cast<void const*> (X), incX, 
00236                    static_cast<void const*> (Y), incY, 
00237                    static_cast<void*> (A), lda); 
00238     }
00239 
00240     inline 
00241     void ger (CBLAS_ORDER const Order, int const M, int const N,
00242               traits::complex_d const& alpha, 
00243               traits::complex_d const* X, int const incX,
00244               traits::complex_d const* Y, int const incY, 
00245               traits::complex_d* A, int const lda)
00246     {
00247       cblas_zgeru (Order, M, N, 
00248                    static_cast<void const*> (&alpha), 
00249                    static_cast<void const*> (X), incX, 
00250                    static_cast<void const*> (Y), incY, 
00251                    static_cast<void*> (A), lda); 
00252     }
00253 
00254     // A <- alpha * x * y^T + A 
00255     // .. complex types only 
00256 
00257     inline 
00258     void geru (CBLAS_ORDER const Order, int const M, int const N,
00259                traits::complex_f const& alpha, 
00260                traits::complex_f const* X, int const incX,
00261                traits::complex_f const* Y, int const incY, 
00262                traits::complex_f* A, int const lda)
00263     {
00264       cblas_cgeru (Order, M, N, 
00265                    static_cast<void const*> (&alpha), 
00266                    static_cast<void const*> (X), incX, 
00267                    static_cast<void const*> (Y), incY, 
00268                    static_cast<void*> (A), lda); 
00269     }
00270 
00271     inline 
00272     void geru (CBLAS_ORDER const Order, int const M, int const N,
00273                traits::complex_d const& alpha, 
00274                traits::complex_d const* X, int const incX,
00275                traits::complex_d const* Y, int const incY, 
00276                traits::complex_d* A, int const lda)
00277     {
00278       cblas_zgeru (Order, M, N, 
00279                    static_cast<void const*> (&alpha), 
00280                    static_cast<void const*> (X), incX, 
00281                    static_cast<void const*> (Y), incY, 
00282                    static_cast<void*> (A), lda); 
00283     }
00284     
00285     // A <- alpha * x * y^H + A 
00286     // .. complex types only 
00287 
00288     inline 
00289     void gerc (CBLAS_ORDER const Order, int const M, int const N,
00290                traits::complex_f const& alpha, 
00291                traits::complex_f const* X, int const incX,
00292                traits::complex_f const* Y, int const incY, 
00293                traits::complex_f* A, int const lda)
00294     {
00295       cblas_cgerc (Order, M, N, 
00296                    static_cast<void const*> (&alpha), 
00297                    static_cast<void const*> (X), incX, 
00298                    static_cast<void const*> (Y), incY, 
00299                    static_cast<void*> (A), lda); 
00300     }
00301 
00302     inline 
00303     void gerc (CBLAS_ORDER const Order, int const M, int const N,
00304                traits::complex_d const& alpha, 
00305                traits::complex_d const* X, int const incX,
00306                traits::complex_d const* Y, int const incY, 
00307                traits::complex_d* A, int const lda)
00308     {
00309       cblas_zgerc (Order, M, N, 
00310                    static_cast<void const*> (&alpha), 
00311                    static_cast<void const*> (X), incX, 
00312                    static_cast<void const*> (Y), incY, 
00313                    static_cast<void*> (A), lda); 
00314     }
00315 
00316 
00317     // A <- alpha * x * x^T + A 
00318     // A real symmetric 
00319 
00320     inline 
00321     void syr (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00322               int const N, float const alpha, 
00323               float const* X, int const incX, float* A, int const lda)
00324     {
00325       cblas_ssyr (Order, Uplo, N, alpha, X, incX, A, lda); 
00326     }
00327 
00328     inline 
00329     void syr (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00330               int const N, double const alpha, 
00331               double const* X, int const incX, double* A, int const lda)
00332     {
00333       cblas_dsyr (Order, Uplo, N, alpha, X, incX, A, lda); 
00334     }
00335 
00336 
00337     // A <- alpha * x * x^T + A 
00338     // A real symmetric in packed form 
00339     
00340     inline 
00341     void spr (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00342               int const N, float const alpha, 
00343               float const* X, int const incX, float* Ap)
00344     {
00345       cblas_sspr (Order, Uplo, N, alpha, X, incX, Ap); 
00346     }
00347 
00348     inline 
00349     void spr (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00350               int const N, double const alpha, 
00351               double const* X, int const incX, double* Ap)
00352     {
00353       cblas_dspr (Order, Uplo, N, alpha, X, incX, Ap); 
00354     }
00355 
00356 
00357     // A <- alpha * x * y^T + alpha * y * x^T + A 
00358     // A real symmetric 
00359 
00360     inline 
00361     void syr2 (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00362                int const N, float const alpha, 
00363                float const* X, int const incX, 
00364                float const* Y, int const incY, 
00365                float* A, int const lda)
00366     {
00367       cblas_ssyr2 (Order, Uplo, N, alpha, X, incX, Y, incY, A, lda); 
00368     }
00369 
00370     inline 
00371     void syr2 (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00372                int const N, double const alpha, 
00373                double const* X, int const incX, 
00374                double const* Y, int const incY, 
00375                double* A, int const lda)
00376     {
00377       cblas_dsyr2 (Order, Uplo, N, alpha, X, incX, Y, incY, A, lda); 
00378     }
00379 
00380 
00381     // A <- alpha * x * y^T + alpha * y * x^T + A 
00382     // A real symmetric in packed form 
00383     
00384     inline 
00385     void spr2 (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00386                int const N, float const alpha, 
00387                float const* X, int const incX, 
00388                float const* Y, int const incY, float* Ap)
00389     {
00390       cblas_sspr2 (Order, Uplo, N, alpha, X, incX, Y, incY, Ap); 
00391     }
00392 
00393     inline 
00394     void spr2 (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00395                int const N, double const alpha, 
00396                double const* X, int const incX, 
00397                double const* Y, int const incY, double* Ap)
00398     {
00399       cblas_dspr2 (Order, Uplo, N, alpha, X, incX, Y, incY, Ap); 
00400     }
00401 
00402 
00403     // A <- alpha * x * x^H + A 
00404     // A hermitian
00405 
00406     inline 
00407     void her (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00408               int const N, float const alpha, 
00409               traits::complex_f const* X, int const incX, 
00410               traits::complex_f* A, int const lda)
00411     {
00412       cblas_cher (Order, Uplo, N, alpha, 
00413                   static_cast<void const*> (X), incX, 
00414                   static_cast<void*> (A), lda); 
00415     }
00416 
00417     inline 
00418     void her (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00419               int const N, double const alpha, 
00420               traits::complex_d const* X, int const incX, 
00421               traits::complex_d* A, int const lda)
00422     {
00423       cblas_zher (Order, Uplo, N, alpha, 
00424                   static_cast<void const*> (X), incX, 
00425                   static_cast<void*> (A), lda); 
00426     }
00427 
00428 
00429     // A <- alpha * x * x^H + A 
00430     // A hermitian in packed form 
00431     
00432     inline 
00433     void hpr (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00434               int const N, float const alpha, 
00435               traits::complex_f const* X, int const incX, 
00436               traits::complex_f* Ap)
00437     {
00438       cblas_chpr (Order, Uplo, N, alpha, 
00439                   static_cast<void const*> (X), incX, 
00440                   static_cast<void*> (Ap)); 
00441     }
00442 
00443     inline 
00444     void hpr (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00445               int const N, double const alpha, 
00446               traits::complex_d const* X, int const incX, 
00447               traits::complex_d* Ap)
00448     {
00449       cblas_zhpr (Order, Uplo, N, alpha, 
00450                   static_cast<void const*> (X), incX, 
00451                   static_cast<void*> (Ap)); 
00452     }
00453 
00454 
00455     // A <- alpha * x * y^H + y * (alpha * x)^H + A 
00456     // A hermitian
00457 
00458     inline 
00459     void her2 (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00460                int const N, traits::complex_f const& alpha, 
00461                traits::complex_f const* X, int const incX, 
00462                traits::complex_f const* Y, int const incY, 
00463                traits::complex_f* A, int const lda)
00464     {
00465       cblas_cher2 (Order, Uplo, N, 
00466                    static_cast<void const*> (&alpha), 
00467                    static_cast<void const*> (X), incX, 
00468                    static_cast<void const*> (Y), incY, 
00469                    static_cast<void*> (A), lda); 
00470     }
00471 
00472     inline 
00473     void her2 (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00474                int const N, traits::complex_d const& alpha, 
00475                traits::complex_d const* X, int const incX, 
00476                traits::complex_d const* Y, int const incY, 
00477                traits::complex_d* A, int const lda)
00478     {
00479       cblas_zher2 (Order, Uplo, N, 
00480                    static_cast<void const*> (&alpha), 
00481                    static_cast<void const*> (X), incX, 
00482                    static_cast<void const*> (Y), incY, 
00483                    static_cast<void*> (A), lda); 
00484     }
00485 
00486 
00487     // A <- alpha * x * y^H + y * (alpha * x)^H + A 
00488     // A hermitian in packed form 
00489     
00490     inline 
00491     void hpr2 (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00492                int const N, traits::complex_f const& alpha, 
00493                traits::complex_f const* X, int const incX, 
00494                traits::complex_f const* Y, int const incY, 
00495                traits::complex_f* Ap)
00496     {
00497       cblas_chpr2 (Order, Uplo, N, 
00498                    static_cast<void const*> (&alpha), 
00499                    static_cast<void const*> (X), incX, 
00500                    static_cast<void const*> (Y), incY, 
00501                    static_cast<void*> (Ap)); 
00502     }
00503 
00504     inline 
00505     void hpr2 (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
00506                int const N, traits::complex_d const& alpha, 
00507                traits::complex_d const* X, int const incX, 
00508                traits::complex_d const* Y, int const incY, 
00509                traits::complex_d* Ap)
00510     {
00511       cblas_zhpr2 (Order, Uplo, N, 
00512                    static_cast<void const*> (&alpha), 
00513                    static_cast<void const*> (X), incX, 
00514                    static_cast<void const*> (Y), incY, 
00515                    static_cast<void*> (Ap)); 
00516     }
00517 
00518 
00519   }} // namepaces detail & atlas
00520 
00521 }}} 
00522 
00523 
00524 #endif // BOOST_NUMERIC_BINDINGS_CBLAS2_OVERLOADS_HPP

Generated on Wed Nov 23 19:00:00 2011 for FreeCAD by  doxygen 1.6.1