AbstractLinAlgPack: C++ Interfaces For Vectors, Matrices And Related Linear Algebra Objects Version of the Day
AbstractLinAlgPack_MatrixNonsing.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 ABSTRACT_LINALG_PACK_MATRIX_NONSINGULAR_H
00043 #define ABSTRACT_LINALG_PACK_MATRIX_NONSINGULAR_H
00044 
00045 #include "AbstractLinAlgPack_MatrixBase.hpp"
00046 #include "Teuchos_RCP.hpp"
00047 
00048 namespace AbstractLinAlgPack {
00049 
00097 class MatrixNonsing : public virtual MatrixBase {
00098 public:
00099 
00102 
00104   friend
00105   void V_InvMtV(
00106     VectorMutable* v_lhs, const MatrixNonsing& M_rhs1
00107     ,BLAS_Cpp::Transp trans_rhs1, const Vector& v_rhs2);
00109   friend
00110   void V_InvMtV(
00111     VectorMutable* v_lhs, const MatrixNonsing& M_rhs1
00112     ,BLAS_Cpp::Transp trans_rhs1, const SpVectorSlice& sv_rhs2);
00114   friend
00115   value_type transVtInvMtV(
00116     const Vector& v_rhs1, const MatrixNonsing& M_rhs2
00117     ,BLAS_Cpp::Transp trans_rhs2, const Vector& v_rhs3);
00119   friend
00120   value_type transVtInvMtV(
00121     const SpVectorSlice& sv_rhs1, const MatrixNonsing& M_rhs2
00122     ,BLAS_Cpp::Transp trans_rhs2, const SpVectorSlice& sv_rhs3);
00124   friend
00125   void M_StInvMtM(
00126     MatrixOp* m_lhs, value_type alpha
00127     ,const MatrixNonsing&  M_rhs1,     BLAS_Cpp::Transp trans_rhs1
00128     ,const MatrixOp&       mwo_rhs2,   BLAS_Cpp::Transp trans_rhs2 );
00130   friend
00131   void M_StMtInvM(
00132     MatrixOp* m_lhs, value_type alpha
00133     ,const MatrixOp&      mwo_rhs1,  BLAS_Cpp::Transp trans_rhs1
00134     ,const MatrixNonsing& M_rhs2,    BLAS_Cpp::Transp trans_rhs2 );
00135 
00137 
00140 
00141 #ifndef DOXYGEN_COMPILE
00142 
00143   typedef Teuchos::RCP<const MatrixNonsing>    mat_mns_ptr_t;
00145   typedef Teuchos::RCP<MatrixNonsing>          mat_mns_mut_ptr_t;
00146 #endif
00147 
00151   class SingularMatrix : public std::logic_error
00152   {public: SingularMatrix(const std::string& what_arg) : std::logic_error(what_arg) {}};
00153 
00155 
00158 
00165   virtual mat_mns_mut_ptr_t clone_mns();
00166 
00175   virtual mat_mns_ptr_t clone_mns() const;
00176 
00178 
00181 
00183   virtual void V_InvMtV(
00184     VectorMutable* v_lhs, BLAS_Cpp::Transp trans_rhs1
00185     ,const Vector& v_rhs2) const = 0;
00187   virtual void V_InvMtV(
00188     VectorMutable* v_lhs, BLAS_Cpp::Transp trans_rhs1
00189     , const SpVectorSlice& sv_rhs2) const;
00191   virtual value_type transVtInvMtV(
00192     const Vector& v_rhs1
00193     ,BLAS_Cpp::Transp trans_rhs2, const Vector& v_rhs3) const;
00195   virtual value_type transVtInvMtV(
00196     const SpVectorSlice& sv_rhs1
00197     ,BLAS_Cpp::Transp trans_rhs2, const SpVectorSlice& sv_rhs3) const;
00198 
00199   //    end Level-2 BLAS
00201 
00204 
00213   virtual void M_StInvMtM(
00214     MatrixOp* m_lhs, value_type alpha
00215     ,BLAS_Cpp::Transp trans_rhs1
00216     ,const MatrixOp& mwo_rhs2, BLAS_Cpp::Transp trans_rhs2
00217     ) const;
00226   virtual void M_StMtInvM(
00227     MatrixOp* m_lhs, value_type alpha
00228     ,const MatrixOp& mwo_rhs1, BLAS_Cpp::Transp trans_rhs1
00229     ,BLAS_Cpp::Transp trans_rhs2
00230     ) const;
00231 
00232   //    end Level-3 BLAS
00234 
00235 };  // end class MatrixNonsing
00236 
00244 
00246 //@ {
00247 
00249 inline void V_InvMtV(
00250   VectorMutable* v_lhs, const MatrixNonsing& M_rhs1
00251   ,BLAS_Cpp::Transp trans_rhs1, const Vector& v_rhs2)
00252 {
00253   M_rhs1.V_InvMtV(v_lhs,trans_rhs1,v_rhs2);
00254 }
00255 
00257 inline void V_InvMtV(
00258   VectorMutable* v_lhs, const MatrixNonsing& M_rhs1
00259   ,BLAS_Cpp::Transp trans_rhs1, const SpVectorSlice& sv_rhs2)
00260 {
00261   M_rhs1.V_InvMtV(v_lhs,trans_rhs1,sv_rhs2);
00262 }
00263 
00265 inline value_type transVtInvMtV(
00266   const Vector& v_rhs1, const MatrixNonsing& M_rhs2
00267   ,BLAS_Cpp::Transp trans_rhs2, const Vector& v_rhs3)
00268 {
00269   return M_rhs2.transVtInvMtV(v_rhs1,trans_rhs2,v_rhs3);
00270 }
00271 
00273 inline value_type transVtInvMtV(
00274   const SpVectorSlice& sv_rhs1, const MatrixNonsing& M_rhs2
00275   ,BLAS_Cpp::Transp trans_rhs2, const SpVectorSlice& sv_rhs3)
00276 {
00277   return M_rhs2.transVtInvMtV(sv_rhs1,trans_rhs2,sv_rhs3);
00278 }
00279 
00280 //    end Level-2 BLAS
00281 //@ }
00282 
00284 //@ {
00285 
00287 inline void M_StInvMtM(
00288   MatrixOp* m_lhs, value_type alpha
00289   ,const MatrixNonsing&  M_rhs1,     BLAS_Cpp::Transp trans_rhs1
00290   ,const MatrixOp&       mwo_rhs2,   BLAS_Cpp::Transp trans_rhs2 )
00291 {
00292   M_rhs1.M_StInvMtM(m_lhs,alpha,trans_rhs1,mwo_rhs2,trans_rhs2);
00293 }
00294 
00296 inline void M_StMtInvM(
00297   MatrixOp* m_lhs, value_type alpha
00298   ,const MatrixOp&      mwo_rhs1,  BLAS_Cpp::Transp trans_rhs1
00299   ,const MatrixNonsing& M_rhs2,    BLAS_Cpp::Transp trans_rhs2 )
00300 {
00301   M_rhs2.M_StMtInvM(m_lhs,alpha,mwo_rhs1,trans_rhs1,trans_rhs2);
00302 }
00303 
00304 //    end Level-3 BLAS
00305 //@ }
00306 
00307 //    end Inline non-member operation functions
00309 
00310 } // end namespace AbstractLinAlgPack
00311 
00312 #endif  // ABSTRACT_LINALG_PACK_MATRIX_NONSINGULAR_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends