|
AbstractLinAlgPack: C++ Interfaces For Vectors, Matrices And Related Linear Algebra Objects 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 #ifndef COOM_PARTITION_OP_H 00030 #define COOM_PARTITION_OP_H 00031 00032 #include "AbstractLinAlgPack_COOMatrixTmplOp.hpp" 00033 00034 namespace AbstractLinAlgPack { 00035 00036 // /////////////////////////////////////////////////////////////////////////// 00044 00045 // //////////////////////////////////////////////////////////////////// 00049 00051 template <class T_Indice, class T_Value> 00052 inline void Mp_StM( DMatrixSlice* gms_lhs, value_type alpha 00053 , const COOMatrixPartitionedViewUtilityPack::Partition<T_Indice,T_Value>& coom_rhs 00054 , BLAS_Cpp::Transp trans_rhs ) 00055 { 00056 Mp_StCOOM(gms_lhs, alpha, coom_rhs, trans_rhs); 00057 } 00058 00060 00061 // /////////////////////////////////////////////////////////////////////// 00069 00071 template <class T_Indice, class T_Value> 00072 inline void Vp_StMtV( DVectorSlice* vs_lhs, value_type alpha 00073 , const COOMatrixPartitionedViewUtilityPack::Partition<T_Indice,T_Value>& coom_rhs1 00074 , BLAS_Cpp::Transp trans_rhs1, const DVectorSlice& vs_rhs2 ) 00075 { 00076 Vp_StCOOMtV(vs_lhs, alpha, coom_rhs1, trans_rhs1, vs_rhs2); 00077 } 00078 00080 template <class T_Indice, class T_Value> 00081 inline void Vp_StMtV( DVectorSlice* vs_lhs, value_type alpha 00082 , const COOMatrixPartitionedViewUtilityPack::Partition<T_Indice,T_Value>& coom_rhs1 00083 , BLAS_Cpp::Transp trans_rhs1, const DVectorSlice& vs_rhs2, value_type beta ) 00084 { 00085 if( beta == 0.0 ) { 00086 *vs_lhs = 0.0; // We must specifically assign this in case uninitialized memory 00087 // was used and you might get NaN by accident (this happened to me!). 00088 } 00089 else { 00090 DenseLinAlgPack::Vt_S(vs_lhs,beta); 00091 } 00092 Vp_StCOOMtV(vs_lhs, alpha, coom_rhs1, trans_rhs1, vs_rhs2); 00093 } 00094 00096 00097 // ///////////////////////////////////////////////////////////////////////////////// 00101 00103 template <class T_Indice, class T_Value> 00104 inline void Mp_StMtM( DMatrixSlice* gms_lhs, value_type alpha 00105 , const COOMatrixPartitionedViewUtilityPack::Partition<T_Indice,T_Value>& coom_rhs1 00106 , BLAS_Cpp::Transp trans_rhs1, const DMatrixSlice& gms_rhs2, BLAS_Cpp::Transp trans_rhs2 ) 00107 { 00108 Mp_StCOOMtM(gms_lhs, alpha, coom_rhs1, trans_rhs1, gms_rhs2, trans_rhs2); 00109 } 00110 00112 template <class T_Indice, class T_Value> 00113 inline void Mp_StMtM( DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSlice& gms_rhs1 00114 , BLAS_Cpp::Transp trans_rhs1 00115 , const COOMatrixPartitionedViewUtilityPack::Partition<T_Indice,T_Value>& coom_rhs2 00116 , BLAS_Cpp::Transp trans_rhs2 ) 00117 { 00118 Mp_StMtCOOM(gms_lhs, alpha, gms_rhs1, trans_rhs1, coom_rhs2, trans_rhs2); 00119 } 00120 00125 template <class T_Indice, class T_Value, class M2> 00126 inline 00127 void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha 00128 , const COOMatrixPartitionedViewUtilityPack::Partition<T_Indice,T_Value>& coom_rhs1 00129 , BLAS_Cpp::Transp trans_rhs1, const M2& M2_rhs2, BLAS_Cpp::Transp trans_rhs2 00130 , value_type beta) 00131 { 00132 Mp_MtM_assert_sizes( gms_lhs->rows(), gms_lhs->cols(), BLAS_Cpp::no_trans 00133 , coom_rhs1.rows(), coom_rhs1.cols(), trans_rhs1 00134 , M2_rhs2.rows(), M2_rhs2.cols(), trans_rhs2 ); 00135 if( beta == 0.0 ) { 00136 *gms_lhs = 0.0; // We must specifically assign this in case uninitialized memory 00137 // was used and you might get NaN by accident (this happened to me!). 00138 } 00139 else { 00140 DenseLinAlgPack::Mt_S(gms_lhs,beta); 00141 } 00142 Mp_StMtM(gms_lhs,alpha,coom_rhs1,trans_rhs1,M2_rhs2,trans_rhs2); 00143 } 00144 00149 template <class M1, class T_Indice, class T_Value> 00150 inline 00151 void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const M1& M1_rhs1 00152 , BLAS_Cpp::Transp trans_rhs1 00153 , const COOMatrixPartitionedViewUtilityPack::Partition<T_Indice,T_Value>& coom_rhs2 00154 , BLAS_Cpp::Transp trans_rhs2, value_type beta) 00155 { 00156 Mp_MtM_assert_sizes( gms_lhs->rows(), gms_lhs->cols(), BLAS_Cpp::no_trans 00157 , M1_rhs1.rows(), M1_rhs1.cols(), trans_rhs1 00158 , coom_rhs2.rows(), coom_rhs2.cols(), trans_rhs2 ); 00159 if( beta == 0.0 ) { 00160 *gms_lhs = 0.0; // We must specifically assign this in case uninitialized memory 00161 // was used and you might get NaN by accident (this happened to me!). 00162 } 00163 else { 00164 DenseLinAlgPack::Mt_S(gms_lhs,beta); 00165 } 00166 Mp_StMtM(gms_lhs,alpha,M1_rhs1,trans_rhs1,coom_rhs2,trans_rhs2); 00167 } 00168 00170 00172 00173 // /////////////////////////////////////////////////////////////////////////// 00181 00182 // //////////////////////////////////////////////////////////////////// 00186 00188 template <class T_Indice, class T_Value> 00189 inline void Mp_StM( DMatrixSlice* gms_lhs, value_type alpha 00190 , const COOMatrixPartitionedViewUtilityPack::TransposedPartition<T_Indice,T_Value>& coom_rhs 00191 , BLAS_Cpp::Transp trans_rhs ) 00192 { 00193 Mp_StCOOM(gms_lhs, alpha, coom_rhs, trans_rhs); 00194 } 00195 00197 00198 // /////////////////////////////////////////////////////////////////////// 00206 00208 template <class T_Indice, class T_Value> 00209 inline void Vp_StMtV( DVectorSlice* vs_lhs, value_type alpha 00210 , const COOMatrixPartitionedViewUtilityPack::TransposedPartition<T_Indice,T_Value>& coom_rhs1 00211 , BLAS_Cpp::Transp trans_rhs1, const DVectorSlice& vs_rhs2 ) 00212 { 00213 Vp_StCOOMtV(vs_lhs, alpha, coom_rhs1, trans_rhs1, vs_rhs2); 00214 } 00215 00217 template <class T_Indice, class T_Value> 00218 inline void Vp_StMtV( DVectorSlice* vs_lhs, value_type alpha 00219 , const COOMatrixPartitionedViewUtilityPack::TransposedPartition<T_Indice,T_Value>& coom_rhs1 00220 , BLAS_Cpp::Transp trans_rhs1, const DVectorSlice& vs_rhs2, value_type beta ) 00221 { 00222 if( beta == 0.0 ) { 00223 *vs_lhs = 0.0; // We must specifically assign this in case uninitialized memory 00224 // was used and you might get NaN by accident (this happened to me!). 00225 } 00226 else { 00227 DenseLinAlgPack::Vt_S(vs_lhs,beta); 00228 } 00229 Vp_StCOOMtV(vs_lhs, alpha, coom_rhs1, trans_rhs1, vs_rhs2); 00230 } 00231 00233 00234 // ///////////////////////////////////////////////////////////////////////////////// 00238 00240 template <class T_Indice, class T_Value> 00241 inline void Mp_StMtM( DMatrixSlice* gms_lhs, value_type alpha 00242 , const COOMatrixPartitionedViewUtilityPack::TransposedPartition<T_Indice,T_Value>& coom_rhs1 00243 , BLAS_Cpp::Transp trans_rhs1, const DMatrixSlice& gms_rhs2, BLAS_Cpp::Transp trans_rhs2 ) 00244 { 00245 Mp_StCOOMtM(gms_lhs, alpha, coom_rhs1, trans_rhs1, gms_rhs2, trans_rhs2); 00246 } 00247 00249 template <class T_Indice, class T_Value> 00250 inline void Mp_StMtM( DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSlice& gms_rhs1 00251 , BLAS_Cpp::Transp trans_rhs1 00252 , const COOMatrixPartitionedViewUtilityPack::TransposedPartition<T_Indice,T_Value>& coom_rhs2 00253 , BLAS_Cpp::Transp trans_rhs2 ) 00254 { 00255 Mp_StMtCOOM(gms_lhs, alpha, gms_rhs1, trans_rhs1, coom_rhs2, trans_rhs2); 00256 } 00257 00262 template <class T_Indice, class T_Value, class M2> 00263 inline 00264 void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha 00265 , const COOMatrixPartitionedViewUtilityPack::TransposedPartition<T_Indice,T_Value>& coom_rhs1 00266 , BLAS_Cpp::Transp trans_rhs1, const M2& M2_rhs2, BLAS_Cpp::Transp trans_rhs2 00267 , value_type beta) 00268 { 00269 Mp_MtM_assert_sizes( gms_lhs->rows(), gms_lhs->cols(), BLAS_Cpp::no_trans 00270 , coom_rhs1.rows(), coom_rhs1.cols(), trans_rhs1 00271 , M2_rhs2.rows(), M2_rhs2.cols(), trans_rhs2 ); 00272 if( beta == 0.0 ) { 00273 *gms_lhs = 0.0; // We must specifically assign this in case uninitialized memory 00274 // was used and you might get NaN by accident (this happened to me!). 00275 } 00276 else { 00277 DenseLinAlgPack::Mt_S(gms_lhs,beta); 00278 } 00279 Mp_StMtM(gms_lhs,alpha,coom_rhs1,trans_rhs1,M2_rhs2,trans_rhs2); 00280 } 00281 00286 template <class M1, class T_Indice, class T_Value> 00287 inline 00288 void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const M1& M1_rhs1 00289 , BLAS_Cpp::Transp trans_rhs1 00290 , const COOMatrixPartitionedViewUtilityPack::TransposedPartition<T_Indice,T_Value>& coom_rhs2 00291 , BLAS_Cpp::Transp trans_rhs2, value_type beta) 00292 { 00293 Mp_MtM_assert_sizes( gms_lhs->rows(), gms_lhs->cols(), BLAS_Cpp::no_trans 00294 , M1_rhs1.rows(), M1_rhs1.cols(), trans_rhs1 00295 , coom_rhs2.rows(), coom_rhs2.cols(), trans_rhs2 ); 00296 if( beta == 0.0 ) { 00297 *gms_lhs = 0.0; // We must specifically assign this in case uninitialized memory 00298 // was used and you might get NaN by accident (this happened to me!). 00299 } 00300 else { 00301 DenseLinAlgPack::Mt_S(gms_lhs,beta); 00302 } 00303 Mp_StMtM(gms_lhs,alpha,M1_rhs1,trans_rhs1,coom_rhs2,trans_rhs2); 00304 } 00305 00307 00309 00310 } // end namespace AbstractLinAlgPack 00311 00312 #endif // COOM_PARTITION_OP_H
1.7.4