Main Page | Namespace List | Class List | File List | Class Members | File Members

blas_wrapper.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2004 by Claudio Attaccalite                             *
00003  *   claudio@freescience.info                                              *
00004  *                                                                         *
00005  *   Original from Davide Ceresoli                                         *
00006  *   http://www.sissa.it/~ceresoli/                                        *
00007  *                                                                         *
00008  *   This program is free software; you can redistribute it and/or modify  *
00009  *   it under the terms of the GNU General Public License as published by  *
00010  *   the Free Software Foundation; either version 2 of the License, or     *
00011  *   (at your option) any later version.                                   *
00012  *                                                                         *
00013  *   This program is distributed in the hope that it will be useful,       *
00014  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00016  *   GNU General Public License for more details.                          *
00017  *                                                                         *
00018  *   You should have received a copy of the GNU General Public License     *
00019  *   along with this program; if not, write to the                         *
00020  *   Free Software Foundation, Inc.,                                       *
00021  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00022  ***************************************************************************/
00023 
00024 #ifndef BlasWrapper_H
00025 #define BlasWrapper_H
00026 
00027 #include <iostream>
00028 #include <math.h>
00029 #include <complex>
00030 
00031 using namespace std;
00032 
00033 #ifndef __C_COMPLEX
00034         #define __C_COMPLEX
00035         typedef struct
00036         {
00037           float re, im;
00038         } __c_complex;
00039         
00040         typedef struct
00041         {
00042           double re, im;
00043         } __c_dcomplex;
00044 #endif
00045 
00046 complex<double> dcmplx(double r,double i);
00047 
00048 #define F77_FUNC(x,y) x##_
00049 
00050 extern "C" {
00051         double F77_FUNC(ddot,DDOT)(int*, double*, int*, double*, int*);
00052 
00053         void F77_FUNC(dcopy,DCOPY)(int*, double*, int*, double*, int*);
00054 
00055         void F77_FUNC(daxpy,DAXPY)(int*, double*, double*, int*, double*, int*);
00056         
00057         double F77_FUNC(dnrm2,DNRM2)(int*, double*, int*);
00058   
00059         int F77_FUNC(idamax,IDAMAX)(int*, double*, int*);
00060         
00061         double F77_FUNC(dasum,DASUM)(int*, double*, int*);
00062         
00063         void F77_FUNC(dscal,DSCAL)(int*, double*, double*, int*);
00064         
00065         void F77_FUNC(dgemm,DGEMM)(char *transa, char *transb, int *m, int *n,
00066                                 int *k,double *alpha, double *a, int *lda, 
00067                                 double *b, int *ldb, double *beta, double *c,
00068                                 int *ldc);
00069   
00070         void F77_FUNC(dgemv,DGEMV)(char *trans, int *m, int *n, double *alpha, 
00071                                   double *a, int *lda, double *x, int *incx, 
00072                                   double *beta, double *y, int *incy);
00073 
00074         float F77_FUNC(sasum,SASUM)(int*, float*, int*);
00075         
00076         float F77_FUNC(sdot,SDOT)(int*, float*, int*, float*, int*);
00077 
00078         void F77_FUNC(scopy,SCOPY)(int*, float*, int*, float*, int*);
00079 
00080         void F77_FUNC(saxpy,SAXPY)(int*, float*, float*, int*, float*, int*);
00081         
00082         float F77_FUNC(snrm2,SNRM2)(int*, float*, int*);
00083         
00084         float F77_FUNC(sasum,SASUM)(int*, float*, int*);
00085         
00086         int F77_FUNC(isamax,ISAMAX)(int*, float*, int*);
00087         
00088         void F77_FUNC(sscal,SSCAL)(int*, float*, float*, int*);
00089         
00090         void F77_FUNC(sgemm,SGEMM)(char *transa, char *transb, int *m, int *n,
00091                                 int *k,float *alpha, float *a, int *lda, 
00092                                 float *b, int *ldb, float *beta, float *c,
00093                                 int *ldc);
00094   
00095         void F77_FUNC(sgemv,SGEMV)(char *trans, int *m, int *n, float *alpha, 
00096                                   float *a, int *lda, float *x, int *incx, 
00097                                   float *beta, float *y, int *incy);
00098 
00099   complex<double> F77_FUNC(zdotu,ZDOTU)(int*, double*, int*, double*, int*);
00100  
00101   complex<double> F77_FUNC(zdotc,ZDOTC)(int*, double*, int*, double*, int*);
00102   
00103   void F77_FUNC(zscal,ZSCAL)(int*, double*, double*, int*);
00104   
00105   void F77_FUNC(zaxpy,ZAXPY)(int*, double*, double*, int*, double*, int*);
00106   
00107   void F77_FUNC(zcopy,ZCOPY)(int*, double*, int*, double*, int*);
00108   
00109   double F77_FUNC(dznrm2,DZNRM2)(int*, double*, int*);
00110  
00111   double F77_FUNC(dzasum,DZASUM)(int*, double*, int*);
00112   
00113   int F77_FUNC(izamax,IZAMAX)(int*, double*, int*);
00114   
00115   void F77_FUNC(zgemm,ZGEMM)(char *transa, char *transb, int *m, int *n, int *k,    double *alpha, double *a, int *lda, double *b, int *ldb,
00116     double *beta, double *c, int *ldc);
00117   
00118   void F77_FUNC(zgemv,ZGEMV)(char *trans, int *m, int *n, double *alpha, 
00119      double *a, int *lda, double *x, int *incx, double *beta, 
00120      double *y, int *incy);
00121 
00122   void F77_FUNC(zgemm,ZGEMM)(char *transa, char *transb, int *m, int *n, int *k,
00123      double *alpha, double *a, int *lda, double *b, int *ldb, double *beta, 
00124      double *c, int *ldc);      
00125 } 
00126 
00127 #endif

Generated on Wed Aug 16 19:03:50 2006 for MyLapack by  doxygen 1.4.4