JWS C Library
C language utility library
blas.h
Go to the documentation of this file.
00001 /*
00002  * This work is licensed under a Creative Commons 
00003  * Attribution-Noncommercial-Share Alike 3.0 United States License.
00004  * 
00005  *    http://creativecommons.org/licenses/by-nc-sa/3.0/us/
00006  * 
00007  * You are free:
00008  * 
00009  *    to Share - to copy, distribute, display, and perform the work
00010  *    to Remix - to make derivative works
00011  * 
00012  * Under the following conditions:
00013  * 
00014  *    Attribution. You must attribute the work in the manner specified by the
00015  *    author or licensor (but not in any way that suggests that they endorse you
00016  *    or your use of the work).
00017  * 
00018  *    Noncommercial. You may not use this work for commercial purposes.
00019  * 
00020  *    Share Alike. If you alter, transform, or build upon this work, you may
00021  *    distribute the resulting work only under the same or similar license to
00022  *    this one.
00023  * 
00024  * For any reuse or distribution, you must make clear to others the license
00025  * terms of this work. The best way to do this is by including this header.
00026  * 
00027  * Any of the above conditions can be waived if you get permission from the
00028  * copyright holder.
00029  * 
00030  * Apart from the remix rights granted under this license, nothing in this
00031  * license impairs or restricts the author's moral rights.
00032  */
00033 
00034 
00053 #ifndef BLAS_H
00054 #define BLAS_H
00055 
00056 
00057 #include <jwsc/config.h>
00058 
00059 #include <stdlib.h>
00060 
00061 #include "jwsc/math/complex.h"
00062 
00063 
00064 #ifdef __cplusplus
00065 namespace jwsc {
00066 extern "C" {
00067 #endif
00068 
00069 
00070 /* ===============  LEVEL 1 PROTOTYPES ==============*/
00071 
00072 
00081 void blas_sswap(int n, float* x, int inc_x, float* y, int inc_y);
00082 
00084 void blas_dswap(int n, double* x, int inc_x, double* y, int inc_y);
00085 
00087 void blas_cswap(int n, Complex_f* x, int inc_x, Complex_f* y, int inc_y);
00088 
00090 void blas_zswap(int n, Complex_d* x, int inc_x, Complex_d* y, int inc_y);
00091 
00105 void blas_sscal(int n, float a, float* x, int inc_x);
00106 
00108 void blas_dscal(int n, double a, double* x, int inc_x);
00109 
00111 void blas_cscal(int n, Complex_f a, Complex_f* x, int inc_x);
00112 
00114 void blas_zscal(int n, Complex_d a, Complex_d* x, int inc_x);
00115 
00129 void blas_scopy(int n, const float* x, int inc_x, float* y, int inc_y);
00130 
00132 void blas_dcopy(int n, const double* x, int inc_x, double* y, int inc_y);
00133 
00135 void blas_ccopy(int n, const Complex_f* x, int inc_x, Complex_f* y, int inc_y);
00136 
00138 void blas_zcopy(int n, const Complex_d* x, int inc_x, Complex_d* y, int inc_y);
00139 
00153 void blas_saxpy
00154 (
00155     int          n, 
00156     float        a, 
00157     const float* x, 
00158     int          inc_x, 
00159     float*       y, 
00160     int          inc_y
00161 );
00162 
00164 void blas_daxpy
00165 (
00166     int           n, 
00167     double        a, 
00168     const double* x, 
00169     int           inc_x, 
00170     double*       y, 
00171     int           inc_y
00172 );
00173 
00175 void blas_caxpy
00176 (
00177     int              n, 
00178     Complex_f        a, 
00179     const Complex_f* x, 
00180     int              inc_x, 
00181     Complex_f*       y, 
00182     int              inc_y
00183 );
00184 
00186 void blas_zaxpy
00187 (
00188     int              n, 
00189     Complex_d        a, 
00190     const Complex_d* x, 
00191     int              inc_x, 
00192     Complex_d*       y, 
00193     int              inc_y
00194 );
00195 
00209 float blas_sdot(int n, const float* x, int inc_x, const float* y, int inc_y);
00210 
00212 double blas_ddot(int n, const double* x, int inc_x, const double* y, int inc_y);
00213 
00227 float blas_snrm2(int n, const float* x, int inc_x);
00228 
00230 double blas_dnrm2(int n, const double* x, int inc_x);
00231 
00245 float blas_sasum(int n, const float* x, int inc_x);
00246 
00248 double blas_dasum(int n, const double* x, int inc_x);
00249 
00263 int blas_isamax(int n, const float* x, int inc_x);
00264 
00266 int blas_idamax(int n, const double* x, int inc_x);
00267 
00269 int blas_icamax(int n, const Complex_f* x, int inc_x);
00270 
00272 int blas_izamax(int n, const Complex_d* x, int inc_x);
00273 
00279 /* ===============  LEVEL 2 PROTOTYPES ==============*/
00280 
00281 
00290 void blas_sgemv
00291 (
00292     char         trans, 
00293     int          m, 
00294     int          n, 
00295     float        alpha, 
00296     const float* A, 
00297     int          lda,
00298     const float* x,
00299     int          inc_x,
00300     float        beta,
00301     float*       y,
00302     int          inc_y
00303 );
00304 
00306 void blas_dgemv
00307 (
00308     char          trans, 
00309     int           m, 
00310     int           n, 
00311     double        alpha, 
00312     const double* A, 
00313     int           lda,
00314     const double* x,
00315     int           inc_x,
00316     double        beta,
00317     double*       y,
00318     int           inc_y
00319 );
00320 
00322 void blas_cgemv
00323 (
00324     char             trans, 
00325     int              m, 
00326     int              n, 
00327     Complex_f        alpha, 
00328     const Complex_f* A, 
00329     int              lda,
00330     const Complex_f* x,
00331     int              inc_x,
00332     Complex_f        beta,
00333     Complex_f*       y,
00334     int              inc_y
00335 );
00336 
00338 void blas_zgemv
00339 (
00340     char             trans, 
00341     int              m, 
00342     int              n, 
00343     Complex_d        alpha, 
00344     const Complex_d* A, 
00345     int              lda,
00346     const Complex_d* x,
00347     int              inc_x,
00348     Complex_d        beta,
00349     Complex_d*       y,
00350     int              inc_y
00351 );
00352 
00359 /* ===============  LEVEL 3 PROTOTYPES ==============*/
00360 
00361 
00370 void blas_sgemm
00371 (
00372     char         trans_a, 
00373     char         trans_b, 
00374     int          m, 
00375     int          n, 
00376     int          k, 
00377     float        alpha, 
00378     const float* A, 
00379     int          lda,
00380     const float* B,
00381     int          ldb,
00382     float        beta,
00383     float*       C,
00384     int          ldc
00385 );
00386 
00388 void blas_dgemm
00389 (
00390     char          trans_a, 
00391     char          trans_b, 
00392     int           m, 
00393     int           n, 
00394     int           k, 
00395     double        alpha, 
00396     const double* A, 
00397     int           lda,
00398     const double* B,
00399     int           ldb,
00400     double        beta,
00401     double*       C,
00402     int           ldc
00403 );
00404 
00406 void blas_cgemm
00407 (
00408     char             trans_a, 
00409     char             trans_b, 
00410     int              m, 
00411     int              n, 
00412     int              k, 
00413     Complex_f        alpha, 
00414     const Complex_f* A, 
00415     int              lda,
00416     const Complex_f* B,
00417     int              ldb,
00418     Complex_f        beta,
00419     Complex_f*       C,
00420     int              ldc
00421 );
00422 
00424 void blas_zgemm
00425 (
00426     char             trans_a, 
00427     char             trans_b, 
00428     int              m, 
00429     int              n, 
00430     int              k, 
00431     Complex_d        alpha, 
00432     const Complex_d* A, 
00433     int              lda,
00434     const Complex_d* B,
00435     int              ldb,
00436     Complex_d        beta,
00437     Complex_d*       C,
00438     int              ldc
00439 );
00440 
00444 #ifdef __cplusplus
00445 }
00446 }
00447 #endif
00448 
00449 
00450 #endif