|
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 #ifndef LIN_ALG_OP_PACK_DECL_H 00043 #define LIN_ALG_OP_PACK_DECL_H 00044 00045 #include "DenseLinAlgPack_DVectorOp.hpp" 00046 #include "DenseLinAlgPack_DMatrixOp.hpp" 00047 00048 namespace LinAlgOpPack { 00049 00050 typedef DenseLinAlgPack::value_type value_type; 00051 00052 using DenseLinAlgPack::DVector; 00053 using DenseLinAlgPack::DVectorSlice; 00054 using DenseLinAlgPack::DMatrix; 00055 using DenseLinAlgPack::DMatrixSlice; 00056 00057 using DenseLinAlgPack::Vt_S; 00058 using DenseLinAlgPack::Vp_StV; 00059 using DenseLinAlgPack::Vp_StMtV; 00060 using DenseLinAlgPack::V_InvMtV; 00061 using DenseLinAlgPack::Mp_StM; 00062 using DenseLinAlgPack::Mp_StMtM; 00063 using DenseLinAlgPack::M_StInvMtM; 00064 00065 // ////////////////////////////////////////////////////////////////////////////// 00066 // ////////////////////////////////////////////////////////////////////////////// 00067 /* * @name Default Linear Algebra implementation operations. 00068 * 00069 * These are template functions that can be used to perform simpler 00070 * linear algebra operations given more elaborate ones. The idea is that 00071 * for each combination of vector and matrix types, the BLAS like operations 00072 * must be provided and then these template functions provide related 00073 * linear algebra operations. The user can override these default implementations 00074 * by defining the exact functions himself. 00075 * 00076 * Warning\\ 00077 * In general it is not allowed for the lhs argument to be used in the rhs expression. 00078 * Concidering aliasing would have make the operations much more complicated. 00079 * So unless you are sure that it is okay, do not use a vector or matrix object 00080 * in both the lhs and rhs expressions. 00081 * 00082 * The nameing covension for these functions is the same as for the linear algebra 00083 * functions for #DVectorSlice# and #DMatrixSlice#. 00084 */ 00085 // @{ 00086 00087 // ////////////////////////////////////////////////////////////////////////////// 00088 // /////////////////////////////////////////////////////////////////////////////// 00089 /* * @name Level 1 BLAS for Vectors 00090 * 00091 * For these functions to work for the type V the following function must 00092 * be defined: 00093 * 00094 * // vs_lhs += alpha * V_rhs \\ 00095 * void Vp_StV(DVectorSlice* vs_lhs, value_type alpha, const V& V_rhs); 00096 * 00097 * The rest of these level 1 BLAS functions implement the variations. 00098 */ 00099 // @{ 00100 00101 // ////////////////////////////////////////////////////////////////////////////// 00102 /* * @name += operations 00103 */ 00104 // @{ 00105 00107 /* * vs_lhs += V_rhs. 00108 * 00109 * Calls: #Vp_StV(vs_lhs,1.0,V_rhs);# 00110 */ 00111 template <class V> 00112 void Vp_V(DVectorSlice* vs_lhs, const V& V_rhs); 00113 00114 // end += operations 00115 // @} 00116 00117 // ////////////////////////////////////////////////////////////////////////////// 00118 /* * @name = operations with DVector as lhs 00119 */ 00120 // @{ 00121 00123 /* * v_lhs = V_rhs. 00124 * 00125 * Calls: #Vp_V(&(*v_lhs)(),V_rhs);# 00126 */ 00127 template <class V> 00128 void assign(DVector* v_lhs, const V& V_rhs); 00129 00131 /* * v_lhs = alpha * V_rhs. 00132 * 00133 * Calls: #Vp_StV(&(*v_lhs)(),alpha,V_rhs);# 00134 */ 00135 template <class V> 00136 void V_StV(DVector* v_lhs, value_type alpha, const V& V_rhs); 00137 00139 /* * v_lhs = - V_rhs. 00140 * 00141 * Calls: #V_StV(&(*v_lhs)(),-1.0,V_rhs);# 00142 */ 00143 template <class V> 00144 void V_mV(DVector* v_lhs, const V& V_rhs); 00145 00147 /* * v_lhs = V1_rhs1 + V2_rhs2. 00148 * 00149 * Calls: #Vp_V(&(*v_lhs)(),V1_rhs1); Vp_V(&(*v_lhs)(),V1_rhs2);# 00150 */ 00151 template <class V1, class V2> 00152 void V_VpV(DVector* v_lhs, const V1& V1_rhs1, const V2& V2_rhs2); 00153 00155 /* * v_lhs = V_rhs1 - V_rhs2. 00156 * 00157 * Calls: #Vp_V(&(*v_lhs)(),V1_rhs1); Vp_StV(&(*v_lhs)(),-1.0,V2_rhs2);# 00158 */ 00159 template <class V1, class V2> 00160 void V_VmV(DVector* v_lhs, const V1& V1_rhs1, const V2& V2_rhs2); 00162 /* * v_lhs = alpha * V_rhs1 + vs_rhs2. 00163 * 00164 * Calls: #Vp_StV(&(*v_lhs)(),alpha,V_rhs1);# 00165 */ 00166 template <class V> 00167 void V_StVpV(DVector* v_lhs, value_type alpha, const V& V_rhs1 00168 , const DVectorSlice& vs_rhs2); 00169 00170 // end = operations with DVector as lhs 00171 // @} 00172 00173 // ////////////////////////////////////////////////////////////////////////////// 00174 /* * @name = operations with DVectorSlice as lhs 00175 */ 00176 // @{ 00177 00179 /* * vs_lhs = V_rhs. 00180 * 00181 * Calls: #Vp_V(vs_lhs,V_rhs);# 00182 */ 00183 template <class V> 00184 void assign(DVectorSlice* vs_lhs, const V& V_rhs); 00185 00187 /* * vs_lhs = alpha * V_rhs. 00188 * 00189 * Calls: #Vp_StV(vs_lhs,alpha,V_rhs);# 00190 */ 00191 template <class V> 00192 void V_StV(DVectorSlice* vs_lhs, value_type alpha, const V& V_rhs); 00193 00195 /* * vs_lhs = - V_rhs. 00196 * 00197 * Calls: #V_StV(vs_lhs,-1.0,V_rhs);# 00198 */ 00199 template <class V> 00200 void V_mV(DVectorSlice* vs_lhs, const V& V_rhs); 00201 00203 /* * vs_lhs = V1_rhs1 + V2_rhs2. 00204 * 00205 * Calls: #Vp_V(vs_lhs,V1_rhs1); Vp_V(vs_lhs,V1_rhs2);# 00206 */ 00207 template <class V1, class V2> 00208 void V_VpV(DVectorSlice* vs_lhs, const V1& V1_rhs1, const V2& V2_rhs2); 00209 00211 /* * vs_lhs = V_rhs1 - V_rhs2. 00212 * 00213 * Calls: #Vp_V(vs_lhs,V1_rhs1); Vp_StV(vs_lhs,-1.0,V2_rhs2);# 00214 */ 00215 template <class V1, class V2> 00216 void V_VmV(DVectorSlice* vs_lhs, const V1& V1_rhs1, const V2& V2_rhs2); 00217 00219 /* * vs_lhs = alpha * V_rhs1 + vs_rhs2. 00220 * 00221 * Calls: #Vp_StV(vs_lhs,alpha,V_rhs1);# 00222 */ 00223 template <class V> 00224 void V_StVpV(DVectorSlice* vs_lhs, value_type alpha, const V& V_rhs1 00225 , const DVectorSlice& vs_rhs2); 00226 00227 // end = operations with DVectorSlice as lhs 00228 // @} 00229 00230 // end Level 1 BLAS for Vectors 00231 // @} 00232 00233 // ////////////////////////////////////////////////////////////////////////////// 00234 // /////////////////////////////////////////////////////////////////////////////// 00235 /* * @name Level 1 BLAS for Matrices 00236 * 00237 * For these functions to work for the type M the following function must 00238 * be defined: 00239 * 00240 * // gms_lhs += alpha * op(M_rhs) \\ 00241 * void Mp_StM(DMatrixSlice* vs_lhs, value_type alpha, const V& V_rhs, BLAS_Cpp::Transp); 00242 * 00243 * The rest of these level 1 BLAS functions implement the variations. 00244 */ 00245 // @{ 00246 00247 // ////////////////////////////////////////////////////////////////////////////// 00248 /* * @name += operations 00249 */ 00250 // @{ 00251 00253 /* * gms_lhs += op(M_rhs). 00254 * 00255 * Calls: #Mp_StM(gms_lhs,1.0,M_rhs,trans_rhs);# 00256 */ 00257 template <class M> 00258 void Mp_M(DMatrixSlice* gms_lhs, const M& M_rhs, BLAS_Cpp::Transp trans_rhs); 00259 00260 // end += operations 00261 // @} 00262 00263 // ////////////////////////////////////////////////////////////////////////////// 00264 /* * @name = operations with DMatrix as lhs 00265 */ 00266 // @{ 00267 00269 /* * gm_lhs = op(M_rhs). 00270 * 00271 * Calls: #Mp_M(&(*gm_lhs)(),M_rhs,trans_rhs);# 00272 */ 00273 template <class M> 00274 void assign(DMatrix* gm_lhs, const M& M_rhs, BLAS_Cpp::Transp trans_rhs); 00275 00277 /* * gm_lhs = alpha * M_rhs. 00278 * 00279 * Calls: #Mp_StM(&(*gm_lhs)(),alpha,M_rhs,trans_rhs);# 00280 */ 00281 template <class M> 00282 void M_StM(DMatrix* v_lhs, value_type alpha, const M& M_rhs 00283 , BLAS_Cpp::Transp trans_rhs); 00284 00286 /* * gm_lhs = - op(M_rhs). 00287 * 00288 * Calls: #M_StM(&(*gm_lhs)(),-1.0,M_rhs,trans_rhs);# 00289 */ 00290 template <class M> 00291 void M_mM(DMatrix* gm_lhs, const M& M_rhs, BLAS_Cpp::Transp trans_rhs) ; 00292 00294 /* * gm_lhs = op(M1_rhs1) + op(M2_rhs2). 00295 * 00296 * Calls: #Mp_M(&(*gm_lhs)(),M1_rhs1,trans_rhs1); Mp_M(&(*gm_lhs)(),M1_rhs2,trans_rhs2);# 00297 */ 00298 template <class M1, class M2> 00299 void M_MpM(DMatrix* gm_lhs, const M1& M1_rhs1, BLAS_Cpp::Transp trans_rhs1 00300 , const M2& M2_rhs2, BLAS_Cpp::Transp trans_rhs2); 00301 00303 /* * gm_lhs = op(M_rhs1) - op(M_rhs2). 00304 * 00305 * Calls: #Mp_M(&(*gm_lhs)(),M1_rhs1,trans_rhs1); Mp_StM(&(*gm_lhs)(),-1.0,M2_rhs2,trans_rhs2);# 00306 */ 00307 template <class M1, class M2> 00308 void M_MmM(DMatrix* gm_lhs, const M1& M1_rhs1, BLAS_Cpp::Transp trans_rhs1 00309 , const M2& M2_rhs2, BLAS_Cpp::Transp trans_rhs2); 00310 00312 /* * gm_lhs = alpha * op(M_rhs1) + op(gms_rhs2). 00313 * 00314 * Calls: #Mp_StM(&(*gm_lhs)(),alpha,M_rhs1,trans_rhs1);# 00315 */ 00316 template <class M> 00317 void M_StMpM(DMatrix* gm_lhs, value_type alpha, const M& M_rhs1, BLAS_Cpp::Transp trans_rhs1 00318 , const DMatrixSlice& gms_rhs2, BLAS_Cpp::Transp trans_rhs2); 00319 00320 // end = operations with DMatrix as lhs 00321 // @} 00322 00323 // ////////////////////////////////////////////////////////////////////////////// 00324 /* * @name = operations with DMatrixSlice as lhs 00325 */ 00326 // @{ 00327 00329 /* * gms_lhs = op(M_rhs). 00330 * 00331 * Calls: #Mp_M(gms_lhs,M_rhs,trans_rhs);# 00332 */ 00333 template <class M> 00334 void assign(DMatrixSlice* gms_lhs, const M& M_rhs, BLAS_Cpp::Transp trans_rhs); 00335 00337 /* * gm_lhs = alpha * M_rhs. 00338 * 00339 * Calls: #Mp_StM(&(*gm_lhs)(),alpha,M_rhs,trans_rhs);# 00340 */ 00341 template <class M> 00342 void M_StM(DMatrixSlice* gms_lhs, value_type alpha, const M& M_rhs 00343 , BLAS_Cpp::Transp trans_rhs); 00344 00346 /* * gm_lhs = - op(M_rhs). 00347 * 00348 * Calls: #M_StM(&(*gm_lhs)(),-1.0,M_rhs,trans_rhs);# 00349 */ 00350 template <class M> 00351 void M_mM(DMatrixSlice* gms_lhs, const M& M_rhs, BLAS_Cpp::Transp trans_rhs) ; 00352 00354 /* * gms_lhs = op(M1_rhs1) + op(M2_rhs2). 00355 * 00356 * Calls: #Mp_M(gms_lhs,M1_rhs1,trans_rhs1); Mp_M(gms_lhs,M1_rhs2,trans_rhs2);# 00357 */ 00358 template <class M1, class M2> 00359 void M_MpM(DMatrixSlice* gms_lhs, const M1& M1_rhs1, BLAS_Cpp::Transp trans_rhs1 00360 , const M2& M2_rhs2, BLAS_Cpp::Transp trans_rhs2); 00361 00363 /* * gms_lhs = op(M_rhs1) - op(M_rhs2). 00364 * 00365 * Calls: #Mp_M(gms_lhs,M1_rhs1,trans_rhs1); Mp_StM(gms_lhs,-1.0,M2_rhs2,trans_rhs2);# 00366 */ 00367 template <class M1, class M2> 00368 void M_MmM(DMatrixSlice* gms_lhs, const M1& M1_rhs1, BLAS_Cpp::Transp trans_rhs1 00369 , const M2& M2_rhs2, BLAS_Cpp::Transp trans_rhs2); 00370 00372 /* * gms_lhs = alpha * op(M_rhs1) + op(gms_rhs2). 00373 * 00374 * Calls: #Mp_StM(gms_lhs,alpha,M_rhs1,trans_rhs1);# 00375 */ 00376 template <class M> 00377 void M_StMpM(DMatrixSlice* gms_lhs, value_type alpha, const M& M_rhs1, BLAS_Cpp::Transp trans_rhs1 00378 , const DMatrixSlice& gms_rhs2, BLAS_Cpp::Transp trans_rhs2); 00379 00380 // end = operations with DMatrixSlice as lhs 00381 // @} 00382 00383 // end Level 1 BLAS for Matrices 00384 // @} 00385 00386 // ////////////////////////////////////////////////////////////////////////////// 00387 // /////////////////////////////////////////////////////////////////////// 00388 /* * @name Level 2 BLAS 00389 * 00390 * These operations implement variations on the Level-2 BLAS operation:\\ 00391 * 00392 * vs_lhs = alpha * op(M_rhs1) * V_rhs2 + beta * vs_lhs 00393 */ 00394 // @{ 00395 00396 // ////////////////////////////////////////////////////////////////////////////// 00397 /* * @name += operations 00398 */ 00399 // @{ 00400 00402 /* * vs_lhs += op(M_rhs1) * V_rhs2. 00403 * 00404 * Calls: #Vp_StMtV(vs_lhs,1.0,M_rhs1,trans_rhs1,V_rhs2);# 00405 */ 00406 template <class M, class V> 00407 void Vp_MtV(DVectorSlice* vs_lhs, const M& M_rhs1, BLAS_Cpp::Transp trans_rhs1 00408 , const V& V_rhs2); 00409 00411 /* * vs_lhs = op(M_rhs1) * V_rhs2 + beta * vs_lhs. 00412 * 00413 * Calls: #Vp_StMtV(vs_lhs,1.0,M_rhs1,trans_rhs1,V_rhs2,beta);# 00414 */ 00415 template <class M, class V> 00416 void Vp_MtV(DVectorSlice* vs_lhs, const M& M_rhs1, BLAS_Cpp::Transp trans_rhs1 00417 , const V& V_rhs2, value_type beta); 00418 00419 // end += operations 00420 // @} 00421 00422 // ////////////////////////////////////////////////////////////////////////////// 00423 /* * @name = operations with DVector as lhs 00424 */ 00425 // @{ 00426 00428 /* * v_lhs = alpha * op(M_rhs1) * V_rhs2. 00429 * 00430 * Calls: #Vp_StMtV(&(*v_lhs)(),alpha,M_rhs1,trans_rhs1,V_rhs2);# 00431 */ 00432 template <class M, class V> 00433 void V_StMtV(DVector* v_lhs, value_type alpha, const M& M_rhs1 00434 , BLAS_Cpp::Transp trans_rhs1, const V& V_rhs2); 00435 00437 /* * v_lhs = op(M_rhs1) * V_rhs2. 00438 * 00439 * Calls: #Vp_MtV(&(*v_lhs)(),M_rhs1,trans_rhs1,V_rhs2);# 00440 */ 00441 template <class M, class V> 00442 void V_MtV(DVector* v_lhs, const M& M_rhs1, BLAS_Cpp::Transp trans_rhs1 00443 , const V& V_rhs2); 00444 00445 // end = operations with DVector as lhs 00446 // @} 00447 00448 // ////////////////////////////////////////////////////////////////////////////// 00449 /* * @name = operations with DVectorSlice as lhs 00450 */ 00451 // @{ 00452 00454 /* * vs_lhs = alpha * op(M_rhs1) * V_rhs2. 00455 * 00456 * Calls: #Vp_StMtV(vs_lhs,alpha,M_rhs1,trans_rhs1,V_rhs2);# 00457 */ 00458 template <class M, class V> 00459 void V_StMtV(DVectorSlice* vs_lhs, value_type alpha, const M& M_rhs1 00460 , BLAS_Cpp::Transp trans_rhs1, const V& V_rhs2); 00461 00463 /* * vs_lhs = op(M_rhs1) * V_rhs2. 00464 * 00465 * Calls: #Vp_MtV(vs_lhs,M_rhs1,trans_rhs1,V_rhs2);# 00466 */ 00467 template <class M, class V> 00468 void V_MtV(DVectorSlice* vs_lhs, const M& M_rhs1, BLAS_Cpp::Transp trans_rhs1 00469 , const V& V_rhs2); 00470 00471 // end = operations with DVectorSlice as lhs 00472 // @} 00473 00474 // end Level 2 BLAS 00475 // @} 00476 00477 // ////////////////////////////////////////////////////////////////////////////// 00478 // ////////////////////////////////////////////////////////////////////////////// 00479 /* * @name Level 3 BLAS 00480 * 00481 * These operations are based on the Level-3 BLAS operation: 00482 * 00483 * gms_lhs = alpha * op(M1_rhs1) * op(M2_rhs2) + beta * gms_lhs 00484 */ 00485 // @{ 00486 00487 // ////////////////////////////////////////////////////////////////////////////// 00488 /* * @name += operations 00489 */ 00490 // @{ 00491 00493 /* * gms_lhs += op(M1_rhs1) * op(M2_rhs2). 00494 * 00495 * Calls: #Mp_StMtM(gms_lhs,1.0,M1_rhs1,trans_rhs1,M2_rhs2,trans_rhs2);# 00496 */ 00497 template <class M1, class M2> 00498 void Mp_MtM(DMatrixSlice* gms_lhs, const M1& M1_rhs1, BLAS_Cpp::Transp trans_rhs1 00499 , const M2& M2_rhs2, BLAS_Cpp::Transp trans_rhs2); 00500 00502 /* * gms_lhs = op(M1_rhs1) * op(M2_rhs2) + beta * gms_rhs. 00503 * 00504 * Calls: #Mp_StMtM(gms_lhs,1.0,M1_rhs1,trans_rhs1,M2_rhs2,trans_rhs2,beta);# 00505 */ 00506 template <class M1, class M2> 00507 void Mp_MtM(DMatrixSlice* gms_lhs, const M1& M1_rhs1, BLAS_Cpp::Transp trans_rhs1 00508 , const M2& M2_rhs2, BLAS_Cpp::Transp trans_rhs2, value_type beta); 00509 00510 // end += operations 00511 // @} 00512 00513 // ////////////////////////////////////////////////////////////////////////////// 00514 /* * @name = operations with DMatrix as lhs 00515 */ 00516 // @{ 00517 00519 /* * gm_lhs = alpha * op(M1_rhs1) * op(M2_rhs2). 00520 * 00521 * Calls: #Mp_StMtM(&(*gm_lhs)(),alpha,M1_rhs1,trans_rhs1,M2_rhs2,trans_rhs2);# 00522 */ 00523 template <class M1, class M2> 00524 void M_StMtM(DMatrix* gm_lhs, value_type alpha, const M1& M1_rhs1 00525 , BLAS_Cpp::Transp trans_rhs1, const M2& M2_rhs2, BLAS_Cpp::Transp trans_rhs2); 00526 00528 /* * gm_lhs = op(M1_rhs1) * op(M2_rhs2). 00529 * 00530 * Calls: #Mp_MtM(&(*gm_lhs)(),M1_rhs1,trans_rhs1,M2_rhs2,trans_rhs2);# 00531 */ 00532 template <class M1, class M2> 00533 void M_MtM(DMatrix* gm_lhs, const M1& M1_rhs1 00534 , BLAS_Cpp::Transp trans_rhs1, const M2& M2_rhs2, BLAS_Cpp::Transp trans_rhs2); 00535 00536 // end = operations with DMatrix as lhs 00537 // @} 00538 00539 // ////////////////////////////////////////////////////////////////////////////// 00540 /* * @name = operations with DMatrixSlice as lhs 00541 */ 00542 // @{ 00543 00545 /* * gms_lhs = alpha * op(M1_rhs1) * op(M2_rhs2). 00546 * 00547 * Calls: #Mp_StMtM(gms_lhs,alpha,M1_rhs1,trans_rhs1,M2_rhs2,trans_rhs2);# 00548 */ 00549 template <class M1, class M2> 00550 void M_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const M1& M1_rhs1 00551 , BLAS_Cpp::Transp trans_rhs1, const M2& M2_rhs2, BLAS_Cpp::Transp trans_rhs2); 00552 00554 /* * gms_lhs = op(M1_rhs1) * op(M2_rhs2). 00555 * 00556 * Calls: #Mp_MtM(gms_lhs,M1_rhs1,trans_rhs1,M2_rhs2,trans_rhs2);# 00557 */ 00558 template <class M1, class M2> 00559 void M_MtM(DMatrixSlice* gms_lhs, const M1& M1_rhs1 00560 , BLAS_Cpp::Transp trans_rhs1, const M2& M2_rhs2, BLAS_Cpp::Transp trans_rhs2); 00561 // end = operations with DMatrixSlice as lhs 00562 // @} 00563 00564 // end Level 3 BLAS 00565 // @} 00566 00567 // end Default Linear Algebra Implementations 00568 // @} 00569 00570 // /////////////////////////////////////////////////////////////////////////// 00571 // /////////////////////////////////////////////////////////////////////////// 00572 // Inline definitions 00573 00574 // /////////////////////////////////////////////////////////////////////////////// 00575 // Level 1 BLAS for Vectors 00576 00577 // vs_lhs += V_rhs. 00578 template <class V> 00579 inline 00580 void Vp_V(DVectorSlice* vs_lhs, const V& V_rhs) { 00581 Vp_StV(vs_lhs,1.0,V_rhs); 00582 } 00583 00584 // v_lhs = - V_rhs. 00585 template <class V> 00586 inline 00587 void V_mV(DVector* v_lhs, const V& V_rhs) { 00588 V_StV(v_lhs,-1.0,V_rhs); 00589 } 00590 00591 // vs_lhs = - V_rhs. 00592 template <class V> 00593 inline 00594 void V_mV(DVectorSlice* vs_lhs, const V& V_rhs) { 00595 V_StV(vs_lhs,-1.0,V_rhs); 00596 } 00597 00598 // /////////////////////////////////////////////////////////////////////////////// 00599 // Level 1 BLAS for Matrices 00600 00601 // gms_lhs += op(M_rhs). 00602 template <class M> 00603 inline 00604 void Mp_M(DMatrixSlice* gms_lhs, const M& M_rhs, BLAS_Cpp::Transp trans_rhs) { 00605 Mp_StM(gms_lhs,1.0,M_rhs,trans_rhs); 00606 } 00607 00608 // gm_lhs = - op(M_rhs). 00609 template <class M> 00610 inline 00611 void M_mM(DMatrix* gm_lhs, const M& M_rhs, BLAS_Cpp::Transp trans_rhs) { 00612 M_StM(gm_lhs,-1.0,M_rhs,trans_rhs); 00613 } 00614 00615 // gms_lhs = - op(M_rhs). 00616 template <class M> 00617 inline 00618 void M_mM(DMatrixSlice* gms_lhs, const M& M_rhs, BLAS_Cpp::Transp trans_rhs) { 00619 M_StM(gms_lhs,-1.0,M_rhs,trans_rhs); 00620 } 00621 00622 // /////////////////////////////////////////////////////////////////////// 00623 // Level 2 BLAS 00624 00625 // vs_lhs += op(M_rhs1) * V_rhs2. 00626 template <class M, class V> 00627 inline 00628 void Vp_MtV(DVectorSlice* vs_lhs, const M& M_rhs1, BLAS_Cpp::Transp trans_rhs1 00629 , const V& V_rhs2) 00630 { 00631 Vp_StMtV(vs_lhs,1.0,M_rhs1,trans_rhs1,V_rhs2); 00632 } 00633 00634 // vs_lhs = op(M_rhs1) * V_rhs2 + beta * vs_lhs. 00635 template <class M, class V> 00636 inline 00637 void Vp_MtV(DVectorSlice* vs_lhs, const M& M_rhs1, BLAS_Cpp::Transp trans_rhs1 00638 , const V& V_rhs2, value_type beta) 00639 { 00640 Vp_StMtV(vs_lhs,1.0,M_rhs1,trans_rhs1,V_rhs2,beta); 00641 } 00642 00643 // ////////////////////////////////////////////////////////////////////////////// 00644 // Level 3 BLAS 00645 00646 // gms_lhs += op(M1_rhs1) * op(M2_rhs2). 00647 template <class M1, class M2> 00648 inline 00649 void Mp_MtM(DMatrixSlice* gms_lhs, const M1& M1_rhs1, BLAS_Cpp::Transp trans_rhs1 00650 , const M2& M2_rhs2, BLAS_Cpp::Transp trans_rhs2) 00651 { 00652 Mp_StMtM(gms_lhs,1.0,M1_rhs1,trans_rhs1,M2_rhs2,trans_rhs2); 00653 } 00654 00655 // gms_lhs = op(M1_rhs1) * op(M2_rhs2) + beta * gms_rhs. 00656 template <class M1, class M2> 00657 inline 00658 void Mp_MtM(DMatrixSlice* gms_lhs, const M1& M1_rhs1, BLAS_Cpp::Transp trans_rhs1 00659 , const M2& M2_rhs2, BLAS_Cpp::Transp trans_rhs2, value_type beta) 00660 { 00661 Mp_StMtM(gms_lhs,1.0,M1_rhs1,trans_rhs1,M2_rhs2,trans_rhs2,beta); 00662 } 00663 00664 00665 } // end namespace LinAlgOpPack 00666 00667 00668 #endif // LIN_ALG_OP_PACK_DECL_H
1.7.6.1