C-XSC - A C++ Class Library for Extended Scientific Computing
2.5.4
|
00001 /* 00002 ** CXSC is a C++ library for eXtended Scientific Computing (V 2.5.4) 00003 ** 00004 ** Copyright (C) 1990-2000 Institut fuer Angewandte Mathematik, 00005 ** Universitaet Karlsruhe, Germany 00006 ** (C) 2000-2014 Wiss. Rechnen/Softwaretechnologie 00007 ** Universitaet Wuppertal, Germany 00008 ** 00009 ** This library is free software; you can redistribute it and/or 00010 ** modify it under the terms of the GNU Library General Public 00011 ** License as published by the Free Software Foundation; either 00012 ** version 2 of the License, or (at your option) any later version. 00013 ** 00014 ** This library is distributed in the hope that it will be useful, 00015 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 ** Library General Public License for more details. 00018 ** 00019 ** You should have received a copy of the GNU Library General Public 00020 ** License along with this library; if not, write to the Free 00021 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 */ 00023 00024 /* CVS $Id: cxsc_blas.hpp,v 1.11 2014/01/30 17:23:44 cxsc Exp $ */ 00025 00026 /* 00027 ** FastPLSS: A library of (parallel) verified linear (interval) system 00028 ** solvers using C-XSC (V 0.2) 00029 ** 00030 ** Author: Michael Zimmer 00031 ** 00032 ** This software is based on: 00033 ** - Module LinSys of the C-XSC-Toolbox 00034 ** Authors: Rolf Hammer, Matthias Hocks, Dietmar Ratz 00035 ** - Self-verifying solver for a dense system of linear equations 00036 ** Authors: Carlos Holbig, Walter Kraemer, Paulo Sergio Morandi Junior, 00037 ** Bernardo Frederes Kramer Alcalde, 00038 */ 00039 00040 00041 #ifndef _CXSC_BLAS_HEADER_INCLUDED 00042 #define _CXSC_BLAS_HEADER_INCLUDED 00043 00044 namespace cxsc { 00045 00046 enum CBLAS_ORDER {CblasRowMajor=101, CblasColMajor=102}; 00047 enum CBLAS_TRANSPOSE {CblasNoTrans=111, CblasTrans=112, CblasConjTrans=113}; 00048 enum CBLAS_UPLO {CblasUpper=121, CblasLower=122}; 00049 enum CBLAS_DIAG {CblasNonUnit=131, CblasUnit=132}; 00050 enum CBLAS_SIDE {CblasLeft=141, CblasRight=142}; 00051 00052 //Declaration of BLAS-routines 00053 extern "C" { 00054 double cblas_ddot(const int N, const double *X, const int incX, 00055 const double *Y, const int incY); 00056 00057 void cblas_zdotu_sub(const int N, const void *X, const int incX, 00058 const void *Y, const int incY, void *dotu); 00059 00060 void cblas_daxpy(const int N, const double alpha, const double *X, 00061 const int incX, double *Y, const int incY); 00062 00063 void cblas_zaxpy(const int N, const double alpha, const double *X, 00064 const int incX, double *Y, const int incY); 00065 00066 void cblas_dgemv(const enum CBLAS_ORDER order, 00067 const enum CBLAS_TRANSPOSE TransA, const int M, const int N, 00068 const double alpha, const double *A, const int lda, 00069 const double *X, const int incX, const double beta, 00070 double *Y, const int incY); 00071 00072 void cblas_zgemv(const enum CBLAS_ORDER order, 00073 const enum CBLAS_TRANSPOSE TransA, const int M, const int N, 00074 const void *alpha, const void *A, const int lda, 00075 const void *X, const int incX, const void *beta, 00076 void *Y, const int incY); 00077 00078 void cblas_dgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, 00079 const enum CBLAS_TRANSPOSE TransB, const int M, const int N, 00080 const int K, const double alpha, const double *A, 00081 const int lda, const double *B, const int ldb, 00082 const double beta, double *C, const int ldc); 00083 00084 void cblas_zgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, 00085 const enum CBLAS_TRANSPOSE TransB, const int M, const int N, 00086 const int K, const void *alpha, const void *A, 00087 const int lda, const void *B, const int ldb, 00088 const void *beta, void *C, const int ldc); 00089 00090 } 00091 00092 inline void blasdot(const rvector& x, const rvector& y, real& res); 00093 00094 inline void blasdot(const rvector& x, const rvector& y, interval& res); 00095 00096 inline void blasdot(const rvector& x, const cvector& y, complex& res); 00097 00098 inline void blasdot(const cvector& x, const rvector& y, complex& res); 00099 00100 inline void blasdot(const rvector& x, const cvector& y, cinterval& res); 00101 00102 inline void blasdot(const cvector& x, const rvector& y, cinterval& res); 00103 00104 inline void blasdot(const cvector& x, const cvector& y, complex& res); 00105 00106 inline void blasdot(const cvector& x, const cvector& y, cinterval& res); 00107 00108 inline void bsort(const ivector &x, const ivector &y, rvector& x_inf, rvector& y_inf, rvector &x_sup, rvector &y_sup, int n, int lb1, int lb2); 00109 00110 //Sorts inf and sup of an interval vector and a real vector into two real vector for the computation of the infimum 00111 //and two real vectors for the computation of the supremum. Rounding mode must be set to upwards! 00112 inline void bsort(const ivector &x, const rvector &y, rvector& x_inf, rvector& y_inf, rvector &x_sup, rvector &y_sup, int n, int lb1, int lb2); 00113 00114 //Sorts inf and sup of an interval vector and a real vector into two real vector for the computation of the infimum 00115 //and two real vectors for the computation of the supremum. Rounding mode must be set to upwards! 00116 inline void bsort(const rvector &y, const ivector &x, rvector& x_inf, rvector& y_inf, rvector &x_sup, rvector &y_sup, int n, int lb1, int lb2); 00117 00118 inline void blasdot(const ivector& x, const ivector& y, interval& res); 00119 00120 inline void blasdot(const ivector& x, const rvector& y, interval& res); 00121 00122 inline void blasdot(const rvector& x, const ivector& y, interval& res); 00123 00124 inline void blasdot(const rvector& x, const civector& y, cinterval& res); 00125 00126 inline void blasdot(const civector& x, const rvector& y, cinterval& res); 00127 00128 inline void blasdot(const cvector& x, const ivector& y, cinterval& res); 00129 00130 inline void blasdot(const ivector& x, const cvector& y, cinterval& res); 00131 00132 inline void blasdot(const civector& x, const civector& y, cinterval& res); 00133 00134 inline void blasdot(const civector& x, const cvector& y, cinterval& res); 00135 00136 inline void blasdot(const cvector& x, const civector& y, cinterval& res); 00137 00138 inline void blasdot(const civector& x, const ivector& y, cinterval& res); 00139 00140 inline void blasdot(const ivector& x, const civector& y, cinterval& res); 00141 00142 /***************************************************************************/ 00143 00144 inline void blasmvmul(const rmatrix& A, const rvector& x, rvector& r); 00145 00146 inline void blasmvmul(const rmatrix& A, const rvector& x, ivector& r); 00147 00148 inline void blasmvmul(const rmatrix& A, const ivector& x, ivector& r); 00149 00150 inline void blasmvmul(const imatrix& A, const rvector& x, ivector& r); 00151 00152 inline void blasmvmul(const imatrix& A, const ivector& x, ivector& r); 00153 00154 inline void blasmvmul(const cmatrix& A, const ivector& x, civector& r); 00155 00156 inline void blasmvmul(const imatrix& A, const cvector& x, civector& r); 00157 00158 inline void blasmvmul(const rmatrix& A, const civector& x, civector& r); 00159 00160 inline void blasmvmul(const cimatrix& A, const rvector& x, civector& r); 00161 00162 inline void blasmvmul(const cmatrix& A, const civector& x, civector& r); 00163 00164 inline void blasmvmul(const cimatrix& A, const cvector& x, civector& r); 00165 00166 inline void blasmvmul(const imatrix& A, const civector& x, civector& r); 00167 00168 inline void blasmvmul(const cimatrix& A, const ivector& x, civector& r); 00169 00170 inline void blasmvmul(const cimatrix& A, const civector& x, civector& r); 00171 00172 inline void blasmvmul(const cmatrix& A, const cvector& x, cvector& r); 00173 00174 inline void blasmvmul(const cmatrix& A, const cvector& x, civector& r); 00175 00176 inline void blasmvmul(const rmatrix& A, const cvector& x, cvector& r); 00177 00178 inline void blasmvmul(const cmatrix& A, const rvector& x, cvector& r); 00179 00180 inline void blasmvmul(const rmatrix& A, const cvector& x, civector& r); 00181 00182 inline void blasmvmul(const cmatrix& A, const rvector& x, civector& r); 00183 00184 /***************************************************************************/ 00185 00186 inline void blasmatmul(const rmatrix &A, const rmatrix &B, imatrix &C); 00187 00188 inline void blasmatmul(const rmatrix &A, const rmatrix &B, rmatrix &C); 00189 00190 inline void blasmatmul(const imatrix &A, const imatrix &B, imatrix &C); 00191 00192 inline void blasmatmul(const rmatrix &A, const imatrix &B, imatrix &C); 00193 00194 inline void blasmatmul(const imatrix &A, const rmatrix &B, imatrix &C); 00195 00196 inline void blasmatmul(const cmatrix &A, const cmatrix &B, cmatrix &C); 00197 00198 inline void blasmatmul(const cmatrix &A, const cmatrix &B, cimatrix &C); 00199 00200 inline void blasmatmul(const cmatrix &A, const rmatrix &B, cmatrix &C); 00201 00202 inline void blasmatmul(const rmatrix &A, const cmatrix &B, cmatrix &C); 00203 00204 inline void blasmatmul(const cmatrix &A, const rmatrix &B, cimatrix &C); 00205 00206 inline void blasmatmul(const rmatrix &A, const cmatrix &B, cimatrix &C); 00207 00208 inline void blasmatmul(const cmatrix &A, const imatrix &B, cimatrix &C); 00209 00210 inline void blasmatmul(const imatrix &A, const cmatrix &B, cimatrix &C); 00211 00212 inline void blasmatmul(const rmatrix &A, const cimatrix &B, cimatrix &C); 00213 00214 inline void blasmatmul(const cimatrix &A, const rmatrix &B, cimatrix &C); 00215 00216 inline void blasmatmul(const imatrix &A, const cimatrix &B, cimatrix &C); 00217 00218 inline void blasmatmul(const cimatrix &A, const imatrix &B, cimatrix &C); 00219 00220 inline void blasmatmul(const cimatrix &A, const cmatrix &B, cimatrix &C); 00221 00222 inline void blasmatmul(const cmatrix &A, const cimatrix &B, cimatrix &C); 00223 00224 inline void blasmatmul(const cimatrix &A, const cimatrix &B, cimatrix &C); 00225 00226 } 00227 00228 #endif