|
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 // Redistribution and use in source and binary forms, with or without 00011 // modification, are permitted provided that the following conditions are 00012 // met: 00013 // 00014 // 1. Redistributions of source code must retain the above copyright 00015 // notice, this list of conditions and the following disclaimer. 00016 // 00017 // 2. Redistributions in binary form must reproduce the above copyright 00018 // notice, this list of conditions and the following disclaimer in the 00019 // documentation and/or other materials provided with the distribution. 00020 // 00021 // 3. Neither the name of the Corporation nor the names of the 00022 // contributors may be used to endorse or promote products derived from 00023 // this software without specific prior written permission. 00024 // 00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY 00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE 00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 // 00037 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 00038 // 00039 // *********************************************************************** 00040 // @HEADER 00041 // 00042 // Basic DMatrix / DMatrixSlice operation functions. 00043 // 00044 // Changes: 6/9/98: 00045 // * I simplified the set of functions to only include direct analogs to 00046 // BLAS routines. Addition operations are derived from these and some 00047 // of the simplifications are given in LinAlgPackOp.h. 00048 // * Testing for aliasing was removed since it provides overhead 00049 // and is only a problem if the lhs argment apears in the rhs. Also it 00050 // will simpify maintance. 00051 // * Changed the naming convension for matrices so that so that they all 00052 // (rectangular, triangular and symmetric) all use just "M". 00053 // * Triangular and symmetric matrices are now aggregated into simple 00054 // classes to simplify the interface and usage. 00055 // * 6/12/98: the assignment functions were moved into a seperate file 00056 // to remove circular dependencies that existed. 00057 00058 #ifndef GEN_MATRIX_OP_H 00059 #define GEN_MATRIX_OP_H 00060 00061 #include "DenseLinAlgPack_Types.hpp" 00062 #include "DenseLinAlgPack_AssertOp.hpp" 00063 #include "DenseLinAlgPack_DMatrixClass.hpp" 00064 #include "DenseLinAlgPack_DMatrixAsTriSym.hpp" 00065 #include "DenseLinAlgPack_DVectorOp.hpp" 00066 00067 /* * @name {\bf Basic DMatrix Operation Functions (Level 2,3 BLAS)}. 00068 * 00069 * These funtions perform that basic linear algebra operations involving; vectors, 00070 * rectangular matrices, triangular matrices, and symmetric matrices. The types 00071 * for the matrices passed to these functions are DMatrix and DMatrixSlice. 00072 * These rectangular matrices can be treated conseptually as square triangular (DMatrixSliceTri) 00073 * and symmetric (DMatrixSliceSym) matrices. The functions are ment to provide the basic computations 00074 * for wrapper classes for triangular (unit diagonal, uppper and lower etc.) 00075 * and symetric (upper or lower triangular storage) which will provide better type 00076 * safty than is achieved by using these function directly. 00077 * 00078 * The implementations of these functions takes care of the following details: 00079 * 00080 * <ul> 00081 * <li> Resizing DMatrix LHS on assignment 00082 * <li> Checking preconditions (sizes of arguments) if \Ref{LINALGPACK_CHECK_RHS_SIZES} is defined 00083 * </ul> 00084 * 00085 * The preconditions for all of the functions are that the sizes of the rhs arguments 00086 * and lhs arguments agree. If they do not and \Ref{LINALGPACK_CHECK_RHS_SIZES} 00087 * is defined, then those functions will throw a #std::length_error# exception. 00088 * 00089 * Naming convenstion for algebric functions. 00090 * 00091 * Algebraic funcitons are named according to their types and the operations on those 00092 * types. For example, condider the functions: 00093 * 00094 * #V_VpV(...)# => #DVectorSlice = DVectorSlice + DVectorSlice# \\ 00095 * #Vp_StV(...)# => #DVectorSlice += Scalar * DVectorSlice# 00096 * 00097 * Reading the first function identifier from left to right, the first letter 'V' stands for the 00098 * type of the lhs argument. The underscore character is ment to stand for the equal sign '='. 00099 * The last part of the identifer name, 'VpV' stands for the binary plus operation "V + V". 00100 * In the second function the characters 'p_' stands for the '+=' operation. 00101 * 00102 * The character identifiers for the types of the operands are (all uppercase): 00103 * 00104 * \begin{center} 00105 * \begin{tabular}{ll} 00106 * types & abreviation \\ 00107 * \hline 00108 * scalar (value_type) & S \\ 00109 * 1-D vectors (DVector (lhs), DVectorSlice) & V \\ 00110 * 2-D matrices (DMatrix (lhs) 00111 * , DMatrixSlice, DMatrixSliceTri, DMatrixSliceTriEle 00112 * , DMatrixSliceSym) & M \\ 00113 * \end{tabular} 00114 * \end{center} 00115 * 00116 * The identifers for the arithmetic operations are (all lowercase): 00117 * 00118 * \begin{center} 00119 * \begin{tabular}{ll} 00120 * Arithmetic operation & abreviation \\ 00121 * \hline 00122 * + (binary plus) & p \\ 00123 * - (binary minus and unary negation) & m \\ 00124 * * (binary multiplation, times) & t \\ 00125 * \end{tabular} 00126 * \end{center} 00127 * 00128 * The types and order of the arguments to these algebraic functions is also 00129 * associated with the names of the identifer of the function. The lhs 00130 * argument(s) always appears first as in the identifer name. The the 00131 * rhs argment(s) appear as they appear in the identifer name. Each type 00132 * operand as one or more arguments associated with it. For example, a 'V' 00133 * for DVectorSlice in a rhs expression only has the type argument 'const DVectorSlice&'. 00134 * A matrix, whether it is rectangular (DMatrixSlice), triangular (DMatrixSliceTri, DMatrixSliceTriEle) 00135 * or symmetric (DMatrixSliceSym). 00136 * 00137 * The identifer names and the corresponding type arguments are: 00138 * 00139 * \begin{center} 00140 * \begin{tabular}{ll} 00141 * {\bf Abreviation} & {\bf Arguments} \\ 00142 * \hline 00143 * S & #value_type# \\ 00144 * V (DVector, lhs only) & #DVector&# \\ 00145 * V (DVectorSlice, lhs) & #DVectorSlice&# \\ 00146 * V (DVectorSlice, rhs) & #const DVectorSlice&# \\ 00147 * M (DMatrix, lhs only) & #DMatrix&# \\ 00148 * M (DMatrixSlice, lhs) & #DMatrixSlice&# \\ 00149 * M (DMatrixSlice, rhs) & #const DMatrixSlice&, BLAS_Cpp::Transp# \\ 00150 * M (Element-wise operation 00151 * Triangular DMatrixSlice 00152 * , lhs) & #DMatrixSliceTriEle&# \\ 00153 * M (Element-wise operation 00154 * Triangular DMatrixSlice 00155 * , rhs) & #const DMatrixSliceTriEle&, BLAS_Cpp::Transp# \\ 00156 * M (Structure dependent operation 00157 * Triangular DMatrixSlice 00158 * , rhs only) & #const DMatrixSliceTri&, BLAS_Cpp::Transp# \\ 00159 * M (Symmetric DMatrixSlice 00160 * , lhs) & #DMatrixSliceTri&# \\ 00161 * M (Symmetric DMatrixSlice 00162 * , rhs) & #cosnt DMatrixSliceTri&, BLAS_Cpp::Transp# \\ 00163 * \end{tabular} 00164 * \end{center} 00165 * 00166 * Using the table above you can deduce the argments by looking at the function identifer name. 00167 * For example, the function #V_MtV# using a triangular matrix and a DVector as the lhs the argument 00168 * type list is: 00169 * #(DVector&, const DMatrixSliceTri&, BLAS_Cpp::Transp, BLAS_Cpp::Diag, const DVectorSlice&)#. 00170 * 00171 * The only variation on this rule is with operations such as: \\ 00172 * vs_lhs = alpha * op(gms_rhs1) * vs_rhs2 + beta * vs_lhs.\\ 00173 * For this type of operation the vs_lhs argument is not included twise as the function would 00174 * be prototyped as: 00175 * 00176 * #void Vp_StMtV(DVectorSlice& vs_lhs, value_type alpha, const DMatrixSlice& gms_rhs1 00177 * , BLAS_Cpp::Transp trans_rhs1, const DVectorSlice& vs_rhs2, value_type beta);# 00178 * 00179 * These operations are designed to work with the LinAlgPackOp template functions. 00180 * These template functions provide default implementations for variations on 00181 * these operations. The BLAS operations for triangular matrix solves do not fit in with 00182 * this system of template functions. 00183 * 00184 * In general it is not allowed that the lhs argument appear in the rhs expression. 00185 * The only exception to this are the Level 2 and 3 BLAS operations that involve 00186 * triangular matrices. Here it is allowed because this is the way the BLAS routines 00187 * are defined. 00188 */ 00189 // @{ 00190 00191 namespace DenseLinAlgPack { 00192 00193 // ///////////////////////////////////////////////////////////////////////////////////////// 00194 /* * @name {\bf Element-wise Algebraic Operations}. 00195 * 00196 * These functions that implement element-wise operations for rectangular 00197 * and triangular regions of matrices. The rhs operands can be transposed 00198 * (op(rhs1) = rhs) or non-transposed (op(rhs1) = trans(rhs1)). 00199 * 00200 * Functions for triangular matrices allow mixes of upper and lower 00201 * triangular regions. Therefore, they provide the machinary for 00202 * element-wise operations for triangular and symmetric matrices. 00203 */ 00204 // @{ 00205 00207 void Mt_S(DMatrixSlice* gms_lhs, value_type alpha); 00208 00210 void M_diagVtM( DMatrixSlice* gms_lhs, const DVectorSlice& vs_rhs 00211 , const DMatrixSlice& gms_rhs, BLAS_Cpp::Transp trans_rhs ); 00212 00214 void Mt_S(DMatrixSliceTriEle* tri_lhs, value_type alpha); 00215 00217 void Mp_StM(DMatrixSliceTriEle* tri_lhs, value_type alpha, const DMatrixSliceTriEle& tri_rhs); 00218 00219 /* * @name LinAlgOpPack compatable (compile-time polymorphism). 00220 */ 00221 // @{ 00222 00224 void Mp_StM(DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSlice& gms_rhs 00225 , BLAS_Cpp::Transp trans_rhs); 00226 00228 void Mp_StM(DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSliceSym& sym_rhs 00229 , BLAS_Cpp::Transp trans_rhs); 00230 00232 void Mp_StM(DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSliceTri& tri_rhs 00233 , BLAS_Cpp::Transp trans_rhs); 00234 00235 // @} 00236 00237 // inline 00238 // /// tri_lhs += alpha * tri_rhs (needed for LinAlgOpPack) 00239 // void Mp_StM(DMatrixSliceTriEle* tri_lhs, value_type alpha, const DMatrixSliceTriEle& tri_rhs 00240 // , BLAS_Cpp::Transp) 00241 //{ 00242 // Mp_StM(tri_lhs, alpha, tri_rhs); 00243 //} 00244 00245 // end Element-wise Algebraic Operations 00246 // @} 00247 00248 // ///////////////////////////////////////////////////////////////////////////////////// 00249 /* * @name {\bf Level-2 BLAS (vector-matrtix) Liner Algebra Operations}. 00250 * 00251 * These functions are setup as nearly direct calls to the level-2 BLAS. 00252 */ 00253 00254 // @{ 00255 00257 void Vp_StMtV(DVectorSlice* vs_lhs, value_type alpha, const DMatrixSlice& gms_rhs1 00258 , BLAS_Cpp::Transp trans_rhs1, const DVectorSlice& vs_rhs2, value_type beta = 1.0); 00259 00261 /* * vs_lhs = alpha * op(sym_rhs1) * vs_rhs2 + beta * vs_lhs. (BLAS xSYMV). 00262 * 00263 * The transpose argument #trans_rhs1# is ignored and is only included so that 00264 * it is compatable with the LinAlgPackOp template functions. 00265 */ 00266 void Vp_StMtV(DVectorSlice* vs_lhs, value_type alpha, const DMatrixSliceSym& sym_rhs1 00267 , BLAS_Cpp::Transp trans_rhs1, const DVectorSlice& vs_rhs2, value_type beta = 1.0); 00268 00270 /* * v_lhs = op(tri_rhs1) * vs_rhs2 (BLAS xTRMV) 00271 * 00272 * Here vs_rhs2 and v_lhs can be the same vector. 00273 * 00274 * Here vs_rhs2 is assigned to v_lhs so if v_lhs is the same as vs_rhs2 00275 * no unnecessary copy will be performed before the BLAS function trmv(...) 00276 * is called. 00277 */ 00278 void V_MtV(DVector* v_lhs, const DMatrixSliceTri& tri_rhs1, BLAS_Cpp::Transp trans_rhs1 00279 , const DVectorSlice& vs_rhs2); 00280 00282 /* * vs_lhs = op(tri_rhs1) * vs_rhs2 (BLAS xTRMV) 00283 * 00284 * Same as previous accept for a DVectorSlice as the lhs. 00285 */ 00286 void V_MtV(DVectorSlice* vs_lhs, const DMatrixSliceTri& tri_rhs1, BLAS_Cpp::Transp trans_rhs1 00287 , const DVectorSlice& vs_rhs2); 00288 00290 /* * vs_lhs = alpha * op(tri_rhs1) * vs_rhs2 + beta * vs_lhs. 00291 * 00292 * This function is needed for use with the LinAlgPackOp template functions. 00293 * Here vs_lhs and vs_rhs2 may be the same vector because of the way that 00294 * the template functions work. 00295 * 00296 * This function calls #V_MtV(tmp, tri_rhs1, trans_rhs1, vs_rhs2);# 00297 * where #tmp# is a temporary vector to hold the result of the operation. 00298 * 00299 */ 00300 void Vp_StMtV(DVectorSlice* vs_lhs, value_type alpha, const DMatrixSliceTri& tri_rhs1 00301 , BLAS_Cpp::Transp trans_rhs1, const DVectorSlice& vs_rhs2, value_type beta = 1.0); 00302 00304 /* * v_lhs = inv(op(tri_rhs1)) * vs_rhs2 (BLAS xTRSV) 00305 * 00306 * Here vs_rhs2 is assigned to v_lhs so if v_lhs is the same as vs_rhs2 00307 * no unnecessary copy will be performed before the BLAS function trsv(...) 00308 * is called. 00309 * 00310 * There are no LinAlgPackOp template functions compatable with this operation. 00311 */ 00312 void V_InvMtV(DVector* v_lhs, const DMatrixSliceTri& tri_rhs1, BLAS_Cpp::Transp trans_rhs1 00313 , const DVectorSlice& vs_rhs2); 00314 00316 /* * vs_lhs = inv(op(tri_rhs1)) * vs_rhs2 (BLAS xTRSV) 00317 * 00318 * Same as above except for DVectorSlice as lhs. 00319 */ 00320 void V_InvMtV(DVectorSlice* vs_lhs, const DMatrixSliceTri& tri_rhs1, BLAS_Cpp::Transp trans_rhs1 00321 , const DVectorSlice& vs_rhs2); 00322 00324 /* * gms_lhs = alpha * vs_rhs1 * vs_rhs2' + gms_lhs (BLAS xGER). 00325 * 00326 * This results in a direct call the the BLAS function ger(...). 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 ger(value_type alpha, const DVectorSlice& vs_rhs1, const DVectorSlice& vs_rhs2 00334 , DMatrixSlice* gms_lhs); 00335 00337 /* * sym_lhs = alpha * vs_rhs * vs_rhs' + sym_lhs (BLAS xSYR). 00338 * 00339 * This results in a direct call the the BLAS function syr(...). 00340 * Since this function is performing a special linear algebra operation (a rank-1 update) 00341 * it does not use the specal naming sceme as the rest of the more typical operations. 00342 * The arguments are ordered similarly to the BLAS specification. 00343 * 00344 * There is no analog to this operation in the LinAlgPackOp template functions. 00345 */ 00346 void syr(value_type alpha, const DVectorSlice& vs_rhs, DMatrixSliceSym* sym_lhs); 00347 00349 /* * sym_lhs = alpha * vs_rhs1 * vs_rhs2' + alpha * vs_rhs2 * vs_rhs1' + sym_lhs (BLAS xSYR2). 00350 * 00351 * There is no analog to this operation in the LinAlgPackOp template functions. 00352 */ 00353 void syr2(value_type alpha, const DVectorSlice& vs_rhs1, const DVectorSlice& vs_rhs2 00354 , DMatrixSliceSym* sym_lhs); 00355 00356 // end Level-2 BLAS (vector-matrtix) Liner Algebra Operations 00357 // @} 00358 00359 // ////////////////////////////////////////////////////////////////////////////////////////// 00360 /* * @name {\bf Level-3 BLAS (matrix-matrix) Linear Algebra Operations}. 00361 * 00362 */ 00363 00364 // @{ 00365 // begin Level-3 BLAS (matrix-matrix) Linear Algebra Operations 00366 00367 // //////////////////////////// 00368 /* * @name Rectangular Matrices 00369 */ 00370 // @{ 00371 00373 /* * gms_lhs = alpha * op(gms_rhs1) * op(gms_rhs2) + beta * gms_lhs (BLAS xGEMV). 00374 * 00375 * This function results in a nearly direct call the the BLAS gemv(...) function. 00376 * No temporaries need to be created. 00377 */ 00378 void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSlice& gms_rhs1 00379 , BLAS_Cpp::Transp trans_rhs1, const DMatrixSlice& gms_rhs2 00380 , BLAS_Cpp::Transp trans_rhs2, value_type beta = 1.0); 00381 00382 // end Rectangular Matrices 00383 // @} 00384 00385 // //////////////////////////// 00386 /* * @name Symmetric Matrices 00387 */ 00388 // @{ 00389 00391 /* * gms_lhs = alpha * op(sym_rhs1) * op(gms_rhs2) + beta * gms_lhs (left) (BLAS xSYMM). 00392 * 00393 * The straight BLAS call would be: 00394 * 00395 * gms_lhs = alpha * sym_rhs1 * gms_rhs2 + beta * gms_lhs 00396 * 00397 * but for compatability with the LinAlgPackOp template functions this form is 00398 * used instead. The first transpose argument #trans_rhs1# is ignorned. 00399 * If #trans_rhs2 == BLAS_Cpp::trans# then a temporary copy of #gms_rhs2# must 00400 * be made to directly call the BLAS function symm(...). 00401 * 00402 */ 00403 void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSliceSym& sym_rhs1 00404 , BLAS_Cpp::Transp trans_rhs1, const DMatrixSlice& gms_rhs2 00405 , BLAS_Cpp::Transp trans_rhs2, value_type beta = 1.0); 00406 00408 /* * gms_lhs = alpha * op(gms_rhs1) * op(sym_rhs2) + beta * gms_lhs (right) (BLAS xSYMM). 00409 * 00410 * This function is similar to the previous one accept the symmeric matrix now appears 00411 * to the right. Again #trans_rhs2# is ignored and a tempory matrix will be created 00412 * if #trans_rhs1 == BLAS_Cpp::trans#. 00413 */ 00414 void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSlice& gms_rhs1 00415 , BLAS_Cpp::Transp trans_rhs1, const DMatrixSliceSym& sym_rhs2 00416 , BLAS_Cpp::Transp trans_rhs2, value_type beta = 1.0); 00417 00419 /* * sym_lhs = alpha * op(gms_rhs) * op(gms_rhs') + beta * sym_lhs (BLAS xSYRK). 00420 * 00421 * This results in a direct call the the BLAS function syrk(...). 00422 * Since this function is performing a special linear algebra operation (a rank-k update) 00423 * it does not use the specal naming sceme as the rest of the more typical operations. 00424 * The arguments are ordered similarly to the BLAS specification. 00425 * 00426 * There is no analog to this operation in the LinAlgPackOp template functions. 00427 */ 00428 void syrk(BLAS_Cpp::Transp trans, value_type alpha, const DMatrixSlice& gms_rhs 00429 , value_type beta, DMatrixSliceSym* sym_lhs); 00430 00432 /* * sym_lhs = alpha * op(gms_rhs1) * op(gms_rhs2') + alpha * op(gms_rhs2) * op(gms_rhs1') 00433 * + beta * sym_lhs (BLAS xSYR2K). 00434 * 00435 * Like syrk(...) this is a specialized linear algebra operation and does not follow the 00436 * standard naming sceme. 00437 * 00438 * There is no analog to this operation in the LinAlgPackOp template functions. 00439 */ 00440 void syr2k(BLAS_Cpp::Transp trans,value_type alpha, const DMatrixSlice& gms_rhs1 00441 , const DMatrixSlice& gms_rhs2, value_type beta, DMatrixSliceSym* sym_lhs); 00442 00443 // end Symmetric Matrices 00444 // @} 00445 00446 // //////////////////////////// 00447 /* * @name Triangular Matrices 00448 */ 00449 // @{ 00450 00452 /* * gm_lhs = alpha * op(tri_rhs1) * op(gms_rhs2) (left) (BLAS xTRMM). 00453 * 00454 * Here op(gms_rhs2) and gms_lhs can be the same matrix . 00455 * 00456 * For the BLAS operation trmm(...) to be called #assign(gm_lhs,gms_rhs2,trans_rhs2)# 00457 * is called first. 00458 */ 00459 void M_StMtM(DMatrix* gm_lhs, value_type alpha, const DMatrixSliceTri& tri_rhs1 00460 , BLAS_Cpp::Transp trans_rhs1, const DMatrixSlice& gms_rhs2 00461 , BLAS_Cpp::Transp trans_rhs2); 00462 00464 /* * gms_lhs = alpha * op(tri_rhs1) * op(gms_rhs2) (left) (BLAS xTRMM). 00465 * 00466 * Same as above accept for DMatrixSlice as the lhs. 00467 */ 00468 void M_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSliceTri& tri_rhs1 00469 , BLAS_Cpp::Transp trans_rhs1, const DMatrixSlice& gms_rhs2 00470 , BLAS_Cpp::Transp trans_rhs2); 00471 00473 /* * gm_lhs = alpha * op(gms_rhs1) * op(tri_rhs2) (right) (BLAS xTRMM). 00474 * 00475 * Here op(gms_rhs1) and gms_lhs can be the same matrix . 00476 * 00477 * For the BLAS operation trmm(...) to be called #assign(gm_lhs,gms_rhs1,trans_rhs1)# 00478 * is called first. This form is used so that it conforms to 00479 * the LinAlgPackOp template functions. 00480 */ 00481 void M_StMtM(DMatrix* gm_lhs, value_type alpha, const DMatrixSlice& gms_rhs1 00482 , BLAS_Cpp::Transp trans_rhs1, const DMatrixSliceTri& tri_rhs2 00483 , BLAS_Cpp::Transp trans_rhs2); 00484 00486 /* * gms_lhs = alpha * op(gms_rhs1) * op(tri_rhs2) (right) (BLAS xTRMM). 00487 * 00488 * Same as above accept for DMatrixSlice as the lhs. 00489 */ 00490 void M_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSlice& gms_rhs1 00491 , BLAS_Cpp::Transp trans_rhs1, const DMatrixSliceTri& tri_rhs2 00492 , BLAS_Cpp::Transp trans_rhs2); 00493 00495 /* * gms_lhs = alpha * op(tri_rhs1) * op(gms_rhs2) + beta * gms_lhs (left). 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,tri_rhs1,trans_rhs1,gms_rhs2,trans_rhs2);# 00502 */ 00503 void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSliceTri& tri_rhs1 00504 , BLAS_Cpp::Transp trans_rhs1, const DMatrixSlice& gms_rhs2 00505 , BLAS_Cpp::Transp trans_rhs2, value_type beta = 1.0); 00506 00508 /* * gms_lhs = alpha * op(gms_rhs1) * op(tri_rhs2) + beta * gms_lhs (right). 00509 * 00510 * This form is included to conform with the LinAlgPackOp template functions. 00511 * For this to work, a temporary (#tmp#) is created to hold the result of the 00512 * matrix-matrix product. 00513 * 00514 * It calls #M_StMtM(&tmp,alpha,gms_rhs1,trans_rhs1,tri_rhs2,trans_rhs2);# 00515 */ 00516 void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSlice& gms_rhs1 00517 , BLAS_Cpp::Transp trans_rhs1, const DMatrixSliceTri& tri_rhs2 00518 , BLAS_Cpp::Transp trans_rhs2, value_type beta = 1.0); 00519 00521 /* * gm_lhs = alpha * inv(op(tri_rhs1)) * op(gms_rhs2) (left) (BLAS xTRSM). 00522 * 00523 * For the BLAS trsm(...) function to be called #assign(gm_lhs,gms_rhs2,trans_rhs2)# 00524 * is called first. 00525 * 00526 * There is no analog to this operation in the LinAlgPackOp template functions. 00527 */ 00528 void M_StInvMtM(DMatrix* gm_lhs, value_type alpha, const DMatrixSliceTri& tri_rhs1 00529 , BLAS_Cpp::Transp trans_rhs1, const DMatrixSlice& gms_rhs2 00530 , BLAS_Cpp::Transp trans_rhs2); 00531 00533 /* * gms_lhs = alpha * inv(op(tri_rhs1)) * op(gms_rhs2) (left) (BLAS xTRSM). 00534 * 00535 * Same as above accept for DMatrixSlice as the lhs. 00536 */ 00537 void M_StInvMtM(DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSliceTri& tri_rhs1 00538 , BLAS_Cpp::Transp trans_rhs1, const DMatrixSlice& gms_rhs2 00539 , BLAS_Cpp::Transp trans_rhs2); 00540 00542 /* * gm_lhs = alpha * op(gms_rhs1) * inv(op(tri_rhs2)) (right) (BLAS xTRSM). 00543 * 00544 * For the BLAS trsm(...) function to be called #assign(gm_lhs,gms_rhs1,trans_rhs1)# 00545 * is called first. 00546 * 00547 * There is no analog to this operation in the LinAlgPackOp template functions. 00548 */ 00549 void M_StMtInvM(DMatrix* gm_lhs, value_type alpha, const DMatrixSlice& gms_rhs1 00550 , BLAS_Cpp::Transp trans_rhs1, const DMatrixSliceTri& tri_rhs2 00551 , BLAS_Cpp::Transp trans_rhs2); 00552 00554 /* * gms_lhs = alpha * op(gms_rhs1) * inv(op(tri_rhs2)) (right) (BLAS xTRSM). 00555 * 00556 * Same as above accept for DMatrixSlice as the lhs. 00557 */ 00558 void M_StMtInvM(DMatrixSlice* gm_lhs, value_type alpha, const DMatrixSlice& gms_rhs1 00559 , BLAS_Cpp::Transp trans_rhs1, const DMatrixSliceTri& tri_rhs2 00560 , BLAS_Cpp::Transp trans_rhs2); 00561 00562 // end Triangular Matrices 00563 // @} 00564 00565 // end Level-3 BLAS (matrix-matrix) Linear Algebra Operations 00566 // @} 00567 00568 } // end namespace DenseLinAlgPack 00569 00570 // ////////////////////////////////////////////////////////////////////////////////////// 00571 // Inline function definitions 00572 00573 // end Basic DMatrix Operation Functions 00574 // @} 00575 00576 #endif // GEN_MATRIX_OP_H
1.7.6.1