AbstractLinAlgPack: C++ Interfaces For Vectors, Matrices And Related Linear Algebra Objects Version of the Day
AbstractLinAlgPack_COOMPartitionOp.hpp
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 COOM_PARTITION_OP_H
00043 #define COOM_PARTITION_OP_H
00044 
00045 #include "AbstractLinAlgPack_COOMatrixTmplOp.hpp"
00046 
00047 namespace AbstractLinAlgPack {
00048 
00049 // ///////////////////////////////////////////////////////////////////////////
00057 
00058 // ////////////////////////////////////////////////////////////////////
00062 
00064 template <class T_Indice, class T_Value>
00065 inline void Mp_StM( DMatrixSlice* gms_lhs, value_type alpha
00066   , const COOMatrixPartitionedViewUtilityPack::Partition<T_Indice,T_Value>& coom_rhs
00067   , BLAS_Cpp::Transp trans_rhs )
00068 {
00069   Mp_StCOOM(gms_lhs, alpha, coom_rhs, trans_rhs);
00070 }
00071 
00073 
00074 // ///////////////////////////////////////////////////////////////////////
00082 
00084 template <class T_Indice, class T_Value>
00085 inline void Vp_StMtV( DVectorSlice* vs_lhs, value_type alpha
00086   , const COOMatrixPartitionedViewUtilityPack::Partition<T_Indice,T_Value>& coom_rhs1
00087   , BLAS_Cpp::Transp trans_rhs1, const DVectorSlice& vs_rhs2 )
00088 {
00089   Vp_StCOOMtV(vs_lhs, alpha, coom_rhs1, trans_rhs1, vs_rhs2);
00090 }
00091 
00093 template <class T_Indice, class T_Value>
00094 inline void Vp_StMtV( DVectorSlice* vs_lhs, value_type alpha
00095   , const COOMatrixPartitionedViewUtilityPack::Partition<T_Indice,T_Value>& coom_rhs1
00096   , BLAS_Cpp::Transp trans_rhs1, const DVectorSlice& vs_rhs2, value_type beta )
00097 {
00098   if( beta == 0.0 ) {
00099     *vs_lhs = 0.0;  // We must specifically assign this in case uninitialized memory
00100             // was used and you might get NaN by accident (this happened to me!).
00101   }
00102   else {
00103     DenseLinAlgPack::Vt_S(vs_lhs,beta);
00104   }
00105   Vp_StCOOMtV(vs_lhs, alpha, coom_rhs1, trans_rhs1, vs_rhs2);
00106 }
00107 
00109 
00110 // /////////////////////////////////////////////////////////////////////////////////
00114 
00116 template <class T_Indice, class T_Value>
00117 inline void Mp_StMtM( DMatrixSlice* gms_lhs, value_type alpha
00118   , const COOMatrixPartitionedViewUtilityPack::Partition<T_Indice,T_Value>& coom_rhs1
00119   , BLAS_Cpp::Transp trans_rhs1, const DMatrixSlice& gms_rhs2, BLAS_Cpp::Transp trans_rhs2 )
00120 {
00121   Mp_StCOOMtM(gms_lhs, alpha, coom_rhs1, trans_rhs1, gms_rhs2, trans_rhs2);
00122 }
00123 
00125 template <class T_Indice, class T_Value>
00126 inline void Mp_StMtM( DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSlice& gms_rhs1
00127   , BLAS_Cpp::Transp trans_rhs1
00128   , const COOMatrixPartitionedViewUtilityPack::Partition<T_Indice,T_Value>& coom_rhs2
00129   , BLAS_Cpp::Transp trans_rhs2 )
00130 {
00131   Mp_StMtCOOM(gms_lhs, alpha, gms_rhs1, trans_rhs1, coom_rhs2, trans_rhs2);
00132 }
00133 
00138 template <class T_Indice, class T_Value, class M2>
00139 inline
00140 void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha
00141   , const COOMatrixPartitionedViewUtilityPack::Partition<T_Indice,T_Value>& coom_rhs1
00142   , BLAS_Cpp::Transp trans_rhs1, const M2& M2_rhs2, BLAS_Cpp::Transp trans_rhs2
00143   , value_type beta)
00144 {
00145   Mp_MtM_assert_sizes(    gms_lhs->rows(), gms_lhs->cols(), BLAS_Cpp::no_trans
00146               , coom_rhs1.rows(), coom_rhs1.cols(), trans_rhs1
00147               , M2_rhs2.rows(), M2_rhs2.cols(), trans_rhs2 );
00148   if( beta == 0.0 ) {
00149     *gms_lhs = 0.0; // We must specifically assign this in case uninitialized memory
00150             // was used and you might get NaN by accident (this happened to me!).
00151   }
00152   else {
00153     DenseLinAlgPack::Mt_S(gms_lhs,beta);
00154   }
00155   Mp_StMtM(gms_lhs,alpha,coom_rhs1,trans_rhs1,M2_rhs2,trans_rhs2);
00156 }
00157 
00162 template <class M1, class T_Indice, class T_Value>
00163 inline
00164 void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const M1& M1_rhs1
00165   , BLAS_Cpp::Transp trans_rhs1
00166   , const COOMatrixPartitionedViewUtilityPack::Partition<T_Indice,T_Value>& coom_rhs2
00167   , BLAS_Cpp::Transp trans_rhs2, value_type beta)
00168 {
00169   Mp_MtM_assert_sizes(    gms_lhs->rows(), gms_lhs->cols(), BLAS_Cpp::no_trans
00170               , M1_rhs1.rows(), M1_rhs1.cols(), trans_rhs1
00171               , coom_rhs2.rows(), coom_rhs2.cols(), trans_rhs2 );
00172   if( beta == 0.0 ) {
00173     *gms_lhs = 0.0; // We must specifically assign this in case uninitialized memory
00174             // was used and you might get NaN by accident (this happened to me!).
00175   }
00176   else {
00177     DenseLinAlgPack::Mt_S(gms_lhs,beta);
00178   }
00179   Mp_StMtM(gms_lhs,alpha,M1_rhs1,trans_rhs1,coom_rhs2,trans_rhs2);
00180 }
00181 
00183 
00185 
00186 // ///////////////////////////////////////////////////////////////////////////
00194 
00195 // ////////////////////////////////////////////////////////////////////
00199 
00201 template <class T_Indice, class T_Value>
00202 inline void Mp_StM( DMatrixSlice* gms_lhs, value_type alpha
00203   , const COOMatrixPartitionedViewUtilityPack::TransposedPartition<T_Indice,T_Value>& coom_rhs
00204   , BLAS_Cpp::Transp trans_rhs )
00205 {
00206   Mp_StCOOM(gms_lhs, alpha, coom_rhs, trans_rhs);
00207 }
00208 
00210 
00211 // ///////////////////////////////////////////////////////////////////////
00219 
00221 template <class T_Indice, class T_Value>
00222 inline void Vp_StMtV( DVectorSlice* vs_lhs, value_type alpha
00223   , const COOMatrixPartitionedViewUtilityPack::TransposedPartition<T_Indice,T_Value>& coom_rhs1
00224   , BLAS_Cpp::Transp trans_rhs1, const DVectorSlice& vs_rhs2 )
00225 {
00226   Vp_StCOOMtV(vs_lhs, alpha, coom_rhs1, trans_rhs1, vs_rhs2);
00227 }
00228 
00230 template <class T_Indice, class T_Value>
00231 inline void Vp_StMtV( DVectorSlice* vs_lhs, value_type alpha
00232   , const COOMatrixPartitionedViewUtilityPack::TransposedPartition<T_Indice,T_Value>& coom_rhs1
00233   , BLAS_Cpp::Transp trans_rhs1, const DVectorSlice& vs_rhs2, value_type beta )
00234 {
00235   if( beta == 0.0 ) {
00236     *vs_lhs = 0.0;  // We must specifically assign this in case uninitialized memory
00237             // was used and you might get NaN by accident (this happened to me!).
00238   }
00239   else {
00240     DenseLinAlgPack::Vt_S(vs_lhs,beta);
00241   }
00242   Vp_StCOOMtV(vs_lhs, alpha, coom_rhs1, trans_rhs1, vs_rhs2);
00243 }
00244 
00246 
00247 // /////////////////////////////////////////////////////////////////////////////////
00251 
00253 template <class T_Indice, class T_Value>
00254 inline void Mp_StMtM( DMatrixSlice* gms_lhs, value_type alpha
00255   , const COOMatrixPartitionedViewUtilityPack::TransposedPartition<T_Indice,T_Value>& coom_rhs1
00256   , BLAS_Cpp::Transp trans_rhs1, const DMatrixSlice& gms_rhs2, BLAS_Cpp::Transp trans_rhs2 )
00257 {
00258   Mp_StCOOMtM(gms_lhs, alpha, coom_rhs1, trans_rhs1, gms_rhs2, trans_rhs2);
00259 }
00260 
00262 template <class T_Indice, class T_Value>
00263 inline void Mp_StMtM( DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSlice& gms_rhs1
00264   , BLAS_Cpp::Transp trans_rhs1
00265   , const COOMatrixPartitionedViewUtilityPack::TransposedPartition<T_Indice,T_Value>& coom_rhs2
00266   , BLAS_Cpp::Transp trans_rhs2 )
00267 {
00268   Mp_StMtCOOM(gms_lhs, alpha, gms_rhs1, trans_rhs1, coom_rhs2, trans_rhs2);
00269 }
00270 
00275 template <class T_Indice, class T_Value, class M2>
00276 inline
00277 void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha
00278   , const COOMatrixPartitionedViewUtilityPack::TransposedPartition<T_Indice,T_Value>& coom_rhs1
00279   , BLAS_Cpp::Transp trans_rhs1, const M2& M2_rhs2, BLAS_Cpp::Transp trans_rhs2
00280   , value_type beta)
00281 {
00282   Mp_MtM_assert_sizes(    gms_lhs->rows(), gms_lhs->cols(), BLAS_Cpp::no_trans
00283               , coom_rhs1.rows(), coom_rhs1.cols(), trans_rhs1
00284               , M2_rhs2.rows(), M2_rhs2.cols(), trans_rhs2 );
00285   if( beta == 0.0 ) {
00286     *gms_lhs = 0.0; // We must specifically assign this in case uninitialized memory
00287             // was used and you might get NaN by accident (this happened to me!).
00288   }
00289   else {
00290     DenseLinAlgPack::Mt_S(gms_lhs,beta);
00291   }
00292   Mp_StMtM(gms_lhs,alpha,coom_rhs1,trans_rhs1,M2_rhs2,trans_rhs2);
00293 }
00294 
00299 template <class M1, class T_Indice, class T_Value>
00300 inline
00301 void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const M1& M1_rhs1
00302   , BLAS_Cpp::Transp trans_rhs1
00303   , const COOMatrixPartitionedViewUtilityPack::TransposedPartition<T_Indice,T_Value>& coom_rhs2
00304   , BLAS_Cpp::Transp trans_rhs2, value_type beta)
00305 {
00306   Mp_MtM_assert_sizes(    gms_lhs->rows(), gms_lhs->cols(), BLAS_Cpp::no_trans
00307               , M1_rhs1.rows(), M1_rhs1.cols(), trans_rhs1
00308               , coom_rhs2.rows(), coom_rhs2.cols(), trans_rhs2 );
00309   if( beta == 0.0 ) {
00310     *gms_lhs = 0.0; // We must specifically assign this in case uninitialized memory
00311             // was used and you might get NaN by accident (this happened to me!).
00312   }
00313   else {
00314     DenseLinAlgPack::Mt_S(gms_lhs,beta);
00315   }
00316   Mp_StMtM(gms_lhs,alpha,M1_rhs1,trans_rhs1,coom_rhs2,trans_rhs2);
00317 }
00318 
00320 
00322 
00323 } // end namespace AbstractLinAlgPack
00324 
00325 #endif  // COOM_PARTITION_OP_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends