|
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 COO_MATRIX_PARTITION_VIEW_SUBCLASS_H 00030 #define COO_MATRIX_PARTITION_VIEW_SUBCLASS_H 00031 00032 #include "AbstractLinAlgPack_MatrixOp.hpp" 00033 #include "AbstractLinAlgPack_COOMatrixWithPartitionedView.hpp" 00034 00035 namespace AbstractLinAlgPack { 00036 00037 // Could not derive this class form MatrixWithOpConcreteEncap because the assignment 00038 // operator is not defined for the partition class. 00039 00043 class COOMatrixPartitionViewSubclass : public MatrixOp 00044 { 00045 public: 00046 00048 typedef COOMatrixWithPartitionedView::partition_type M; 00049 00051 COOMatrixPartitionViewSubclass() 00052 : trans_(BLAS_Cpp::no_trans) 00053 {} 00054 00056 COOMatrixPartitionViewSubclass(BLAS_Cpp::Transp trans) 00057 : trans_(trans) 00058 {} 00059 00061 COOMatrixPartitionViewSubclass(const M& m) 00062 : m_(m), trans_(BLAS_Cpp::no_trans) 00063 {} 00064 00066 COOMatrixPartitionViewSubclass(const M& m, BLAS_Cpp::Transp trans) 00067 : m_(m), trans_(trans) 00068 {} 00069 00071 void set_trans(BLAS_Cpp::Transp trans) { 00072 trans_ = trans; 00073 } 00074 00075 // ///////////////////////////////////////////////////// 00078 00080 M& m() { 00081 return m_; 00082 } 00083 00085 const M& m() const { 00086 return m_; 00087 } 00088 00089 // end Representation access 00091 00092 // ///////////////////////////////////////////////////// 00093 // Overridden from Matrix 00094 00096 size_type rows() const; 00097 00099 size_type cols() const; 00100 00101 // ///////////////////////////////////////////////////// 00102 // Overridden from MatrixOp 00103 00105 MatrixOp& operator=(const MatrixOp& m); 00106 00107 // ///////////////////////////////////////////////////// 00110 00112 void Mp_StM(DMatrixSlice* gms_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs) const; 00113 00114 // end Level-1 BLAS 00116 00117 // //////////////////////////////////////////////////// 00120 00122 void Vp_StMtV(DVectorSlice* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1 00123 , const DVectorSlice& vs_rhs2, value_type beta) const; 00124 00126 void Vp_StMtV(DVectorSlice* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1 00127 , const SpVectorSlice& sv_rhs2, value_type beta) const; 00128 00130 value_type transVtMtV(const DVectorSlice& vs_rhs1, BLAS_Cpp::Transp trans_rhs2 00131 , const DVectorSlice& vs_rhs3) const; 00132 00134 value_type transVtMtV(const SpVectorSlice& sv_rhs1, BLAS_Cpp::Transp trans_rhs2 00135 , const SpVectorSlice& sv_rhs3) const; 00136 00137 // end Level-2 BLAS 00139 00140 // //////////////////////////////////////////////////// 00143 00145 void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha 00146 , BLAS_Cpp::Transp trans_rhs1, const DMatrixSlice& gms_rhs2 00147 , BLAS_Cpp::Transp trans_rhs2, value_type beta) const; 00148 00150 void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSlice& gms_rhs1 00151 , BLAS_Cpp::Transp trans_rhs1, BLAS_Cpp::Transp trans_rhs2, value_type beta) const; 00152 00153 // end Level-3 BLAS 00155 00156 private: 00157 M m_; 00158 BLAS_Cpp::Transp trans_; // for how the matrix if viewed as. 00159 00160 BLAS_Cpp::Transp op(BLAS_Cpp::Transp trans) const { 00161 using BLAS_Cpp::trans_not; 00162 return trans_ == BLAS_Cpp::no_trans ? trans : trans_not(trans); 00163 } 00164 00165 }; // end class COOMatrixPartitionViewSubclass 00166 00167 } // end namespace AbstractLinAlgPack 00168 00169 #endif // COO_MATRIX_PARTITION_VIEW_SUBCLASS_H
1.7.4