00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef F77_INTERFACE_HH
00021 #define F77_INTERFACE_HH
00022 #include "f77_interface_base.hh"
00023 #include <string>
00024
00025 extern "C"
00026 {
00027 void dmxv_(double * A, int * N, double * X, int * M, double *R);
00028 void smxv_(float * A, int * N, float * X, int * M, float *R);
00029
00030 void dmxm_(double * A, int * N, double * B, int * M, double *C, int * K);
00031 void smxm_(float * A, int * N, float * B, int * M, float *C, int * K);
00032
00033 void data_(double * A, double *X, int * N);
00034 void sata_(float * A, float *X, int * N);
00035
00036 void daat_(double * A, double *X, int * N);
00037 void saat_(float * A, float *X, int * N);
00038
00039 void saxpyf_(int * N, float * coef, float * X, float *Y);
00040 void daxpyf_(int * N, double * coef, double * X, double *Y);
00041 }
00042
00043 template<class real>
00044 class f77_interface : public f77_interface_base<real>
00045 {
00046 public :
00047
00048 typedef typename f77_interface_base<real>::gene_matrix gene_matrix;
00049 typedef typename f77_interface_base<real>::gene_vector gene_vector;
00050
00051 static inline std::string name( void )
00052 {
00053 return "f77";
00054 }
00055
00056 static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N)
00057 {
00058 dmxv_(A,&N,B,&N,X);
00059 }
00060
00061 static inline void matrix_matrix_product(gene_matrix & A, gene_matrix & B, gene_matrix & X, int N)
00062 {
00063 dmxm_(A,&N,B,&N,X,&N);
00064 }
00065
00066 static inline void ata_product(gene_matrix & A, gene_matrix & X, int N)
00067 {
00068 data_(A,X,&N);
00069 }
00070
00071 static inline void aat_product(gene_matrix & A, gene_matrix & X, int N)
00072 {
00073 daat_(A,X,&N);
00074 }
00075
00076 static inline void axpy(real coef, const gene_vector & X, gene_vector & Y, int N)
00077 {
00078 int one=1;
00079 daxpyf_(&N,&coef,X,Y);
00080 }
00081
00082
00083 };
00084
00085
00086 template<>
00087 class f77_interface<float> : public f77_interface_base<float>
00088 {
00089 public :
00090
00091 static inline std::string name( void )
00092 {
00093 return "F77";
00094 }
00095
00096
00097 static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N)
00098 {
00099 smxv_(A,&N,B,&N,X);
00100 }
00101
00102 static inline void matrix_matrix_product(gene_matrix & A, gene_matrix & B, gene_matrix & X, int N)
00103 {
00104 smxm_(A,&N,B,&N,X,&N);
00105 }
00106
00107 static inline void ata_product(gene_matrix & A, gene_matrix & X, int N)
00108 {
00109 sata_(A,X,&N);
00110 }
00111
00112 static inline void aat_product(gene_matrix & A, gene_matrix & X, int N)
00113 {
00114 saat_(A,X,&N);
00115 }
00116
00117
00118 static inline void axpy(float coef, const gene_vector & X, gene_vector & Y, int N)
00119 {
00120 saxpyf_(&N,&coef,X,Y);
00121 }
00122
00123 };
00124
00125
00126 #endif
00127
00128
00129