|
DenseLinAlgPack: Concreate C++ Classes for Dense Blas-Compatible Linear Algebra Version of the Day
|
00001 // @HEADER 00002 // *********************************************************************** 00003 // 00004 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization 00005 // Copyright (2003) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // This library is free software; you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as 00012 // published by the Free Software Foundation; either version 2.1 of the 00013 // License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public 00021 // License along with this library; if not, write to the Free Software 00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00023 // USA 00024 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 00025 // 00026 // *********************************************************************** 00027 // @HEADER 00028 // 00029 // Basic DMatrix / DMatrixSlice operation functions. 00030 // 00031 // Changes: 6/9/98: 00032 // * I simplified the set of functions to only include direct analogs to 00033 // BLAS routines. Addition operations are derived from these and some 00034 // of the simplifications are given in LinAlgPackOp.h. 00035 // * Testing for aliasing was removed since it provides overhead 00036 // and is only a problem if the lhs argment apears in the rhs. Also it 00037 // will simpify maintance. 00038 // * Changed the naming convension for matrices so that so that they all 00039 // (rectangular, triangular and symmetric) all use just "M". 00040 // * Triangular and symmetric matrices are now aggregated into simple 00041 // classes to simplify the interface and usage. 00042 // * 6/12/98: the assignment functions were moved into a seperate file 00043 // to remove circular dependencies that existed. 00044 00045 #ifndef GEN_MATRIX_OP_H 00046 #define GEN_MATRIX_OP_H 00047 00048 #include "DenseLinAlgPack_Types.hpp" 00049 #include "DenseLinAlgPack_AssertOp.hpp" 00050 #include "DenseLinAlgPack_DMatrixClass.hpp" 00051 #include "DenseLinAlgPack_DMatrixAsTriSym.hpp" 00052 #include "DenseLinAlgPack_DVectorOp.hpp" 00053 00054 /* * @name {\bf Basic DMatrix Operation Functions (Level 2,3 BLAS)}. 00055 * 00056 * These funtions perform that basic linear algebra operations involving; vectors, 00057 * rectangular matrices, triangular matrices, and symmetric matrices. The types 00058 * for the matrices passed to these functions are DMatrix and DMatrixSlice. 00059 * These rectangular matrices can be treated conseptually as square triangular (DMatrixSliceTri) 00060 * and symmetric (DMatrixSliceSym) matrices. The functions are ment to provide the basic computations 00061 * for wrapper classes for triangular (unit diagonal, uppper and lower etc.) 00062 * and symetric (upper or lower triangular storage) which will provide better type 00063 * safty than is achieved by using these function directly. 00064 * 00065 * The implementations of these functions takes care of the following details: 00066 * 00067 * <ul> 00068 * <li> Resizing DMatrix LHS on assignment 00069 * <li> Checking preconditions (sizes of arguments) if \Ref{LINALGPACK_CHECK_RHS_SIZES} is defined 00070 * </ul> 00071 * 00072 * The preconditions for all of the functions are that the sizes of the rhs arguments 00073 * and lhs arguments agree. If they do not and \Ref{LINALGPACK_CHECK_RHS_SIZES} 00074 * is defined, then those functions will throw a #std::length_error# exception. 00075 * 00076 * Naming convenstion for algebric functions. 00077 * 00078 * Algebraic funcitons are named according to their types and the operations on those 00079 * types. For example, condider the functions: 00080 * 00081 * #V_VpV(...)# => #DVectorSlice = DVectorSlice + DVectorSlice# \\ 00082 * #Vp_StV(...)# => #DVectorSlice += Scalar * DVectorSlice# 00083 * 00084 * Reading the first function identifier from left to right, the first letter 'V' stands for the 00085 * type of the lhs argument. The underscore character is ment to stand for the equal sign '='. 00086 * The last part of the identifer name, 'VpV' stands for the binary plus operation "V + V". 00087 * In the second function the characters 'p_' stands for the '+=' operation. 00088 * 00089 * The character identifiers for the types of the operands are (all uppercase): 00090 * 00091 * \begin{center} 00092 * \begin{tabular}{ll} 00093 * types & abreviation \\ 00094 * \hline 00095 * scalar (value_type) & S \\ 00096 * 1-D vectors (DVector (lhs), DVectorSlice) & V \\ 00097 * 2-D matrices (DMatrix (lhs) 00098 * , DMatrixSlice, DMatrixSliceTri, DMatrixSliceTriEle 00099 * , DMatrixSliceSym) & M \\ 00100 * \end{tabular} 00101 * \end{center} 00102 * 00103 * The identifers for the arithmetic operations are (all lowercase): 00104 * 00105 * \begin{center} 00106 * \begin{tabular}{ll} 00107 * Arithmetic operation & abreviation \\ 00108 * \hline 00109 * + (binary plus) & p \\ 00110 * - (binary minus and unary negation) & m \\ 00111 * * (binary multiplation, times) & t \\ 00112 * \end{tabular} 00113 * \end{center} 00114 * 00115 * The types and order of the arguments to these algebraic functions is also 00116 * associated with the names of the identifer of the function. The lhs 00117 * argument(s) always appears first as in the identifer name. The the 00118 * rhs argment(s) appear as they appear in the identifer name. Each type 00119 * operand as one or more arguments associated with it. For example, a 'V' 00120 * for DVectorSlice in a rhs expression only has the type argument 'const DVectorSlice&'. 00121 * A matrix, whether it is rectangular (DMatrixSlice), triangular (DMatrixSliceTri, DMatrixSliceTriEle) 00122 * or symmetric (DMatrixSliceSym). 00123 * 00124 * The identifer names and the corresponding type arguments are: 00125 * 00126 * \begin{center} 00127 * \begin{tabular}{ll} 00128 * {\bf Abreviation} & {\bf Arguments} \\ 00129 * \hline 00130 * S & #value_type# \\ 00131 * V (DVector, lhs only) & #DVector&# \\ 00132 * V (DVectorSlice, lhs) & #DVectorSlice&# \\ 00133 * V (DVectorSlice, rhs) & #const DVectorSlice&# \\ 00134 * M (DMatrix, lhs only) & #DMatrix&# \\ 00135 * M (DMatrixSlice, lhs) & #DMatrixSlice&# \\ 00136 * M (DMatrixSlice, rhs) & #const DMatrixSlice&, BLAS_Cpp::Transp# \\ 00137 * M (Element-wise operation 00138 * Triangular DMatrixSlice 00139 * , lhs) & #DMatrixSliceTriEle&# \\ 00140 * M (Element-wise operation 00141 * Triangular DMatrixSlice 00142 * , rhs) & #const DMatrixSliceTriEle&, BLAS_Cpp::Transp# \\ 00143 * M (Structure dependent operation 00144 * Triangular DMatrixSlice 00145 * , rhs only) & #const DMatrixSliceTri&, BLAS_Cpp::Transp# \\ 00146 * M (Symmetric DMatrixSlice 00147 * , lhs) & #DMatrixSliceTri&# \\ 00148 * M (Symmetric DMatrixSlice 00149 * , rhs) & #cosnt DMatrixSliceTri&, BLAS_Cpp::Transp# \\ 00150 * \end{tabular} 00151 * \end{center} 00152 * 00153 * Using the table above you can deduce the argments by looking at the function identifer name. 00154 * For example, the function #V_MtV# using a triangular matrix and a DVector as the lhs the argument 00155 * type list is: 00156 * #(DVector&, const DMatrixSliceTri&, BLAS_Cpp::Transp, BLAS_Cpp::Diag, const DVectorSlice&)#. 00157 * 00158 * The only variation on this rule is with operations such as: \\ 00159 * vs_lhs = alpha * op(gms_rhs1) * vs_rhs2 + beta * vs_lhs.\\ 00160 * For this type of operation the vs_lhs argument is not included twise as the function would 00161 * be prototyped as: 00162 * 00163 * #void Vp_StMtV(DVectorSlice& vs_lhs, value_type alpha, const DMatrixSlice& gms_rhs1 00164 * , BLAS_Cpp::Transp trans_rhs1, const DVectorSlice& vs_rhs2, value_type beta);# 00165 * 00166 * These operations are designed to work with the LinAlgPackOp template functions. 00167 * These template functions provide default implementations for variations on 00168 * these operations. The BLAS operations for triangular matrix solves do not fit in with 00169 * this system of template functions. 00170 * 00171 * In general it is not allowed that the lhs argument appear in the rhs expression. 00172 * The only exception to this are the Level 2 and 3 BLAS operations that involve 00173 * triangular matrices. Here it is allowed because this is the way the BLAS routines 00174 * are defined. 00175 */ 00176 // @{ 00177 00178 namespace DenseLinAlgPack { 00179 00180 // ///////////////////////////////////////////////////////////////////////////////////////// 00181 /* * @name {\bf Element-wise Algebraic Operations}. 00182 * 00183 * These functions that implement element-wise operations for rectangular 00184 * and triangular regions of matrices. The rhs operands can be transposed 00185 * (op(rhs1) = rhs) or non-transposed (op(rhs1) = trans(rhs1)). 00186 * 00187 * Functions for triangular matrices allow mixes of upper and lower 00188 * triangular regions. Therefore, they provide the machinary for 00189 * element-wise operations for triangular and symmetric matrices. 00190 */ 00191 // @{ 00192 00194 void Mt_S(DMatrixSlice* gms_lhs, value_type alpha); 00195 00197 void M_diagVtM( DMatrixSlice* gms_lhs, const DVectorSlice& vs_rhs 00198 , const DMatrixSlice& gms_rhs, BLAS_Cpp::Transp trans_rhs ); 00199 00201 void Mt_S(DMatrixSliceTriEle* tri_lhs, value_type alpha); 00202 00204 void Mp_StM(DMatrixSliceTriEle* tri_lhs, value_type alpha, const DMatrixSliceTriEle& tri_rhs); 00205 00206 /* * @name LinAlgOpPack compatable (compile-time polymorphism). 00207 */ 00208 // @{ 00209 00211 void Mp_StM(DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSlice& gms_rhs 00212 , BLAS_Cpp::Transp trans_rhs); 00213 00215 void Mp_StM(DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSliceSym& sym_rhs 00216 , BLAS_Cpp::Transp trans_rhs); 00217 00219 void Mp_StM(DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSliceTri& tri_rhs 00220 , BLAS_Cpp::Transp trans_rhs); 00221 00222 // @} 00223 00224 // inline 00225 // /// tri_lhs += alpha * tri_rhs (needed for LinAlgOpPack) 00226 // void Mp_StM(DMatrixSliceTriEle* tri_lhs, value_type alpha, const DMatrixSliceTriEle& tri_rhs 00227 // , BLAS_Cpp::Transp) 00228 //{ 00229 // Mp_StM(tri_lhs, alpha, tri_rhs); 00230 //} 00231 00232 // end Element-wise Algebraic Operations 00233 // @} 00234 00235 // ///////////////////////////////////////////////////////////////////////////////////// 00236 /* * @name {\bf Level-2 BLAS (vector-matrtix) Liner Algebra Operations}. 00237 * 00238 * These functions are setup as nearly direct calls to the level-2 BLAS. 00239 */ 00240 00241 // @{ 00242 00244 void Vp_StMtV(DVectorSlice* vs_lhs, value_type alpha, const DMatrixSlice& gms_rhs1 00245 , BLAS_Cpp::Transp trans_rhs1, const DVectorSlice& vs_rhs2, value_type beta = 1.0); 00246 00248 /* * vs_lhs = alpha * op(sym_rhs1) * vs_rhs2 + beta * vs_lhs. (BLAS xSYMV). 00249 * 00250 * The transpose argument #trans_rhs1# is ignored and is only included so that 00251 * it is compatable with the LinAlgPackOp template functions. 00252 */ 00253 void Vp_StMtV(DVectorSlice* vs_lhs, value_type alpha, const DMatrixSliceSym& sym_rhs1 00254 , BLAS_Cpp::Transp trans_rhs1, const DVectorSlice& vs_rhs2, value_type beta = 1.0); 00255 00257 /* * v_lhs = op(tri_rhs1) * vs_rhs2 (BLAS xTRMV) 00258 * 00259 * Here vs_rhs2 and v_lhs can be the same vector. 00260 * 00261 * Here vs_rhs2 is assigned to v_lhs so if v_lhs is the same as vs_rhs2 00262 * no unnecessary copy will be performed before the BLAS function trmv(...) 00263 * is called. 00264 */ 00265 void V_MtV(DVector* v_lhs, const DMatrixSliceTri& tri_rhs1, BLAS_Cpp::Transp trans_rhs1 00266 , const DVectorSlice& vs_rhs2); 00267 00269 /* * vs_lhs = op(tri_rhs1) * vs_rhs2 (BLAS xTRMV) 00270 * 00271 * Same as previous accept for a DVectorSlice as the lhs. 00272 */ 00273 void V_MtV(DVectorSlice* vs_lhs, const DMatrixSliceTri& tri_rhs1, BLAS_Cpp::Transp trans_rhs1 00274 , const DVectorSlice& vs_rhs2); 00275 00277 /* * vs_lhs = alpha * op(tri_rhs1) * vs_rhs2 + beta * vs_lhs. 00278 * 00279 * This function is needed for use with the LinAlgPackOp template functions. 00280 * Here vs_lhs and vs_rhs2 may be the same vector because of the way that 00281 * the template functions work. 00282 * 00283 * This function calls #V_MtV(tmp, tri_rhs1, trans_rhs1, vs_rhs2);# 00284 * where #tmp# is a temporary vector to hold the result of the operation. 00285 * 00286 */ 00287 void Vp_StMtV(DVectorSlice* vs_lhs, value_type alpha, const DMatrixSliceTri& tri_rhs1 00288 , BLAS_Cpp::Transp trans_rhs1, const DVectorSlice& vs_rhs2, value_type beta = 1.0); 00289 00291 /* * v_lhs = inv(op(tri_rhs1)) * vs_rhs2 (BLAS xTRSV) 00292 * 00293 * Here vs_rhs2 is assigned to v_lhs so if v_lhs is the same as vs_rhs2 00294 * no unnecessary copy will be performed before the BLAS function trsv(...) 00295 * is called. 00296 * 00297 * There are no LinAlgPackOp template functions compatable with this operation. 00298 */ 00299 void V_InvMtV(DVector* v_lhs, const DMatrixSliceTri& tri_rhs1, BLAS_Cpp::Transp trans_rhs1 00300 , const DVectorSlice& vs_rhs2); 00301 00303 /* * vs_lhs = inv(op(tri_rhs1)) * vs_rhs2 (BLAS xTRSV) 00304 * 00305 * Same as above except for DVectorSlice as lhs. 00306 */ 00307 void V_InvMtV(DVectorSlice* vs_lhs, const DMatrixSliceTri& tri_rhs1, BLAS_Cpp::Transp trans_rhs1 00308 , const DVectorSlice& vs_rhs2); 00309 00311 /* * gms_lhs = alpha * vs_rhs1 * vs_rhs2' + gms_lhs (BLAS xGER). 00312 * 00313 * This results in a direct call the the BLAS function ger(...). 00314 * Since this function is performing a special linear algebra operation (a rank-1 update) 00315 * it does not use the specal naming sceme as the rest of the more typical operations. 00316 * The arguments are ordered similarly to the BLAS specification. 00317 * 00318 * There is no analog to this operation in the LinAlgPackOp template functions. 00319 */ 00320 void ger(value_type alpha, const DVectorSlice& vs_rhs1, const DVectorSlice& vs_rhs2 00321 , DMatrixSlice* gms_lhs); 00322 00324 /* * sym_lhs = alpha * vs_rhs * vs_rhs' + sym_lhs (BLAS xSYR). 00325 * 00326 * This results in a direct call the the BLAS function syr(...). 00327 * Since this function is performing a special linear algebra operation (a rank-1 update) 00328 * it does not use the specal naming sceme as the rest of the more typical operations. 00329 * The arguments are ordered similarly to the BLAS specification. 00330 * 00331 * There is no analog to this operation in the LinAlgPackOp template functions. 00332 */ 00333 void syr(value_type alpha, const DVectorSlice& vs_rhs, DMatrixSliceSym* sym_lhs); 00334 00336 /* * sym_lhs = alpha * vs_rhs1 * vs_rhs2' + alpha * vs_rhs2 * vs_rhs1' + sym_lhs (BLAS xSYR2). 00337 * 00338 * There is no analog to this operation in the LinAlgPackOp template functions. 00339 */ 00340 void syr2(value_type alpha, const DVectorSlice& vs_rhs1, const DVectorSlice& vs_rhs2 00341 , DMatrixSliceSym* sym_lhs); 00342 00343 // end Level-2 BLAS (vector-matrtix) Liner Algebra Operations 00344 // @} 00345 00346 // ////////////////////////////////////////////////////////////////////////////////////////// 00347 /* * @name {\bf Level-3 BLAS (matrix-matrix) Linear Algebra Operations}. 00348 * 00349 */ 00350 00351 // @{ 00352 // begin Level-3 BLAS (matrix-matrix) Linear Algebra Operations 00353 00354 // //////////////////////////// 00355 /* * @name Rectangular Matrices 00356 */ 00357 // @{ 00358 00360 /* * gms_lhs = alpha * op(gms_rhs1) * op(gms_rhs2) + beta * gms_lhs (BLAS xGEMV). 00361 * 00362 * This function results in a nearly direct call the the BLAS gemv(...) function. 00363 * No temporaries need to be created. 00364 */ 00365 void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSlice& gms_rhs1 00366 , BLAS_Cpp::Transp trans_rhs1, const DMatrixSlice& gms_rhs2 00367 , BLAS_Cpp::Transp trans_rhs2, value_type beta = 1.0); 00368 00369 // end Rectangular Matrices 00370 // @} 00371 00372 // //////////////////////////// 00373 /* * @name Symmetric Matrices 00374 */ 00375 // @{ 00376 00378 /* * gms_lhs = alpha * op(sym_rhs1) * op(gms_rhs2) + beta * gms_lhs (left) (BLAS xSYMM). 00379 * 00380 * The straight BLAS call would be: 00381 * 00382 * gms_lhs = alpha * sym_rhs1 * gms_rhs2 + beta * gms_lhs 00383 * 00384 * but for compatability with the LinAlgPackOp template functions this form is 00385 * used instead. The first transpose argument #trans_rhs1# is ignorned. 00386 * If #trans_rhs2 == BLAS_Cpp::trans# then a temporary copy of #gms_rhs2# must 00387 * be made to directly call the BLAS function symm(...). 00388 * 00389 */ 00390 void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSliceSym& sym_rhs1 00391 , BLAS_Cpp::Transp trans_rhs1, const DMatrixSlice& gms_rhs2 00392 , BLAS_Cpp::Transp trans_rhs2, value_type beta = 1.0); 00393 00395 /* * gms_lhs = alpha * op(gms_rhs1) * op(sym_rhs2) + beta * gms_lhs (right) (BLAS xSYMM). 00396 * 00397 * This function is similar to the previous one accept the symmeric matrix now appears 00398 * to the right. Again #trans_rhs2# is ignored and a tempory matrix will be created 00399 * if #trans_rhs1 == BLAS_Cpp::trans#. 00400 */ 00401 void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSlice& gms_rhs1 00402 , BLAS_Cpp::Transp trans_rhs1, const DMatrixSliceSym& sym_rhs2 00403 , BLAS_Cpp::Transp trans_rhs2, value_type beta = 1.0); 00404 00406 /* * sym_lhs = alpha * op(gms_rhs) * op(gms_rhs') + beta * sym_lhs (BLAS xSYRK). 00407 * 00408 * This results in a direct call the the BLAS function syrk(...). 00409 * Since this function is performing a special linear algebra operation (a rank-k update) 00410 * it does not use the specal naming sceme as the rest of the more typical operations. 00411 * The arguments are ordered similarly to the BLAS specification. 00412 * 00413 * There is no analog to this operation in the LinAlgPackOp template functions. 00414 */ 00415 void syrk(BLAS_Cpp::Transp trans, value_type alpha, const DMatrixSlice& gms_rhs 00416 , value_type beta, DMatrixSliceSym* sym_lhs); 00417 00419 /* * sym_lhs = alpha * op(gms_rhs1) * op(gms_rhs2') + alpha * op(gms_rhs2) * op(gms_rhs1') 00420 * + beta * sym_lhs (BLAS xSYR2K). 00421 * 00422 * Like syrk(...) this is a specialized linear algebra operation and does not follow the 00423 * standard naming sceme. 00424 * 00425 * There is no analog to this operation in the LinAlgPackOp template functions. 00426 */ 00427 void syr2k(BLAS_Cpp::Transp trans,value_type alpha, const DMatrixSlice& gms_rhs1 00428 , const DMatrixSlice& gms_rhs2, value_type beta, DMatrixSliceSym* sym_lhs); 00429 00430 // end Symmetric Matrices 00431 // @} 00432 00433 // //////////////////////////// 00434 /* * @name Triangular Matrices 00435 */ 00436 // @{ 00437 00439 /* * gm_lhs = alpha * op(tri_rhs1) * op(gms_rhs2) (left) (BLAS xTRMM). 00440 * 00441 * Here op(gms_rhs2) and gms_lhs can be the same matrix . 00442 * 00443 * For the BLAS operation trmm(...) to be called #assign(gm_lhs,gms_rhs2,trans_rhs2)# 00444 * is called first. 00445 */ 00446 void M_StMtM(DMatrix* gm_lhs, value_type alpha, const DMatrixSliceTri& tri_rhs1 00447 , BLAS_Cpp::Transp trans_rhs1, const DMatrixSlice& gms_rhs2 00448 , BLAS_Cpp::Transp trans_rhs2); 00449 00451 /* * gms_lhs = alpha * op(tri_rhs1) * op(gms_rhs2) (left) (BLAS xTRMM). 00452 * 00453 * Same as above accept for DMatrixSlice as the lhs. 00454 */ 00455 void M_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSliceTri& tri_rhs1 00456 , BLAS_Cpp::Transp trans_rhs1, const DMatrixSlice& gms_rhs2 00457 , BLAS_Cpp::Transp trans_rhs2); 00458 00460 /* * gm_lhs = alpha * op(gms_rhs1) * op(tri_rhs2) (right) (BLAS xTRMM). 00461 * 00462 * Here op(gms_rhs1) and gms_lhs can be the same matrix . 00463 * 00464 * For the BLAS operation trmm(...) to be called #assign(gm_lhs,gms_rhs1,trans_rhs1)# 00465 * is called first. This form is used so that it conforms to 00466 * the LinAlgPackOp template functions. 00467 */ 00468 void M_StMtM(DMatrix* gm_lhs, value_type alpha, const DMatrixSlice& gms_rhs1 00469 , BLAS_Cpp::Transp trans_rhs1, const DMatrixSliceTri& tri_rhs2 00470 , BLAS_Cpp::Transp trans_rhs2); 00471 00473 /* * gms_lhs = alpha * op(gms_rhs1) * op(tri_rhs2) (right) (BLAS xTRMM). 00474 * 00475 * Same as above accept for DMatrixSlice as the lhs. 00476 */ 00477 void M_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSlice& gms_rhs1 00478 , BLAS_Cpp::Transp trans_rhs1, const DMatrixSliceTri& tri_rhs2 00479 , BLAS_Cpp::Transp trans_rhs2); 00480 00482 /* * gms_lhs = alpha * op(tri_rhs1) * op(gms_rhs2) + beta * gms_lhs (left). 00483 * 00484 * This form is included to conform with the LinAlgPackOp template functions. 00485 * For this to work, a temporary (#tmp#) is created to hold the result of the 00486 * matrix-matrix product. 00487 * 00488 * It calls #M_StMtM(&tmp,alpha,tri_rhs1,trans_rhs1,gms_rhs2,trans_rhs2);# 00489 */ 00490 void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSliceTri& tri_rhs1 00491 , BLAS_Cpp::Transp trans_rhs1, const DMatrixSlice& gms_rhs2 00492 , BLAS_Cpp::Transp trans_rhs2, value_type beta = 1.0); 00493 00495 /* * gms_lhs = alpha * op(gms_rhs1) * op(tri_rhs2) + beta * gms_lhs (right). 00496 * 00497 * This form is included to conform with the LinAlgPackOp template functions. 00498 * For this to work, a temporary (#tmp#) is created to hold the result of the 00499 * matrix-matrix product. 00500 * 00501 * It calls #M_StMtM(&tmp,alpha,gms_rhs1,trans_rhs1,tri_rhs2,trans_rhs2);# 00502 */ 00503 void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSlice& gms_rhs1 00504 , BLAS_Cpp::Transp trans_rhs1, const DMatrixSliceTri& tri_rhs2 00505 , BLAS_Cpp::Transp trans_rhs2, value_type beta = 1.0); 00506 00508 /* * gm_lhs = alpha * inv(op(tri_rhs1)) * op(gms_rhs2) (left) (BLAS xTRSM). 00509 * 00510 * For the BLAS trsm(...) function to be called #assign(gm_lhs,gms_rhs2,trans_rhs2)# 00511 * is called first. 00512 * 00513 * There is no analog to this operation in the LinAlgPackOp template functions. 00514 */ 00515 void M_StInvMtM(DMatrix* gm_lhs, value_type alpha, const DMatrixSliceTri& tri_rhs1 00516 , BLAS_Cpp::Transp trans_rhs1, const DMatrixSlice& gms_rhs2 00517 , BLAS_Cpp::Transp trans_rhs2); 00518 00520 /* * gms_lhs = alpha * inv(op(tri_rhs1)) * op(gms_rhs2) (left) (BLAS xTRSM). 00521 * 00522 * Same as above accept for DMatrixSlice as the lhs. 00523 */ 00524 void M_StInvMtM(DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSliceTri& tri_rhs1 00525 , BLAS_Cpp::Transp trans_rhs1, const DMatrixSlice& gms_rhs2 00526 , BLAS_Cpp::Transp trans_rhs2); 00527 00529 /* * gm_lhs = alpha * op(gms_rhs1) * inv(op(tri_rhs2)) (right) (BLAS xTRSM). 00530 * 00531 * For the BLAS trsm(...) function to be called #assign(gm_lhs,gms_rhs1,trans_rhs1)# 00532 * is called first. 00533 * 00534 * There is no analog to this operation in the LinAlgPackOp template functions. 00535 */ 00536 void M_StMtInvM(DMatrix* gm_lhs, value_type alpha, const DMatrixSlice& gms_rhs1 00537 , BLAS_Cpp::Transp trans_rhs1, const DMatrixSliceTri& tri_rhs2 00538 , BLAS_Cpp::Transp trans_rhs2); 00539 00541 /* * gms_lhs = alpha * op(gms_rhs1) * inv(op(tri_rhs2)) (right) (BLAS xTRSM). 00542 * 00543 * Same as above accept for DMatrixSlice as the lhs. 00544 */ 00545 void M_StMtInvM(DMatrixSlice* gm_lhs, value_type alpha, const DMatrixSlice& gms_rhs1 00546 , BLAS_Cpp::Transp trans_rhs1, const DMatrixSliceTri& tri_rhs2 00547 , BLAS_Cpp::Transp trans_rhs2); 00548 00549 // end Triangular Matrices 00550 // @} 00551 00552 // end Level-3 BLAS (matrix-matrix) Linear Algebra Operations 00553 // @} 00554 00555 } // end namespace DenseLinAlgPack 00556 00557 // ////////////////////////////////////////////////////////////////////////////////////// 00558 // Inline function definitions 00559 00560 // end Basic DMatrix Operation Functions 00561 // @} 00562 00563 #endif // GEN_MATRIX_OP_H
1.7.4