MOOCHO (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AbstractLinAlgPack_MatrixNonsing.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
5 // Copyright (2003) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov)
38 //
39 // ***********************************************************************
40 // @HEADER
41 //
42 #ifndef ABSTRACT_LINALG_PACK_MATRIX_NONSINGULAR_H
43 #define ABSTRACT_LINALG_PACK_MATRIX_NONSINGULAR_H
44 
46 #include "Teuchos_RCP.hpp"
47 
48 namespace AbstractLinAlgPack {
49 
97 class MatrixNonsing : public virtual MatrixBase {
98 public:
99 
102 
104  friend
105  void V_InvMtV(
106  VectorMutable* v_lhs, const MatrixNonsing& M_rhs1
107  ,BLAS_Cpp::Transp trans_rhs1, const Vector& v_rhs2);
109  friend
110  void V_InvMtV(
111  VectorMutable* v_lhs, const MatrixNonsing& M_rhs1
112  ,BLAS_Cpp::Transp trans_rhs1, const SpVectorSlice& sv_rhs2);
114  friend
116  const Vector& v_rhs1, const MatrixNonsing& M_rhs2
117  ,BLAS_Cpp::Transp trans_rhs2, const Vector& v_rhs3);
119  friend
121  const SpVectorSlice& sv_rhs1, const MatrixNonsing& M_rhs2
122  ,BLAS_Cpp::Transp trans_rhs2, const SpVectorSlice& sv_rhs3);
124  friend
125  void M_StInvMtM(
126  MatrixOp* m_lhs, value_type alpha
127  ,const MatrixNonsing& M_rhs1, BLAS_Cpp::Transp trans_rhs1
128  ,const MatrixOp& mwo_rhs2, BLAS_Cpp::Transp trans_rhs2 );
130  friend
131  void M_StMtInvM(
132  MatrixOp* m_lhs, value_type alpha
133  ,const MatrixOp& mwo_rhs1, BLAS_Cpp::Transp trans_rhs1
134  ,const MatrixNonsing& M_rhs2, BLAS_Cpp::Transp trans_rhs2 );
135 
137 
140 
141 #ifndef DOXYGEN_COMPILE
142 
143  typedef Teuchos::RCP<const MatrixNonsing> mat_mns_ptr_t;
145  typedef Teuchos::RCP<MatrixNonsing> mat_mns_mut_ptr_t;
146 #endif
147 
151  class SingularMatrix : public std::logic_error
152  {public: SingularMatrix(const std::string& what_arg) : std::logic_error(what_arg) {}};
153 
155 
158 
165  virtual mat_mns_mut_ptr_t clone_mns();
166 
175  virtual mat_mns_ptr_t clone_mns() const;
176 
178 
181 
183  virtual void V_InvMtV(
184  VectorMutable* v_lhs, BLAS_Cpp::Transp trans_rhs1
185  ,const Vector& v_rhs2) const = 0;
187  virtual void V_InvMtV(
188  VectorMutable* v_lhs, BLAS_Cpp::Transp trans_rhs1
189  , const SpVectorSlice& sv_rhs2) const;
191  virtual value_type transVtInvMtV(
192  const Vector& v_rhs1
193  ,BLAS_Cpp::Transp trans_rhs2, const Vector& v_rhs3) const;
195  virtual value_type transVtInvMtV(
196  const SpVectorSlice& sv_rhs1
197  ,BLAS_Cpp::Transp trans_rhs2, const SpVectorSlice& sv_rhs3) const;
198 
199  // end Level-2 BLAS
201 
204 
213  virtual void M_StInvMtM(
214  MatrixOp* m_lhs, value_type alpha
215  ,BLAS_Cpp::Transp trans_rhs1
216  ,const MatrixOp& mwo_rhs2, BLAS_Cpp::Transp trans_rhs2
217  ) const;
226  virtual void M_StMtInvM(
227  MatrixOp* m_lhs, value_type alpha
228  ,const MatrixOp& mwo_rhs1, BLAS_Cpp::Transp trans_rhs1
229  ,BLAS_Cpp::Transp trans_rhs2
230  ) const;
231 
232  // end Level-3 BLAS
234 
235 }; // end class MatrixNonsing
236 
244 
246 //@ {
247 
249 inline void V_InvMtV(
250  VectorMutable* v_lhs, const MatrixNonsing& M_rhs1
251  ,BLAS_Cpp::Transp trans_rhs1, const Vector& v_rhs2)
252 {
253  M_rhs1.V_InvMtV(v_lhs,trans_rhs1,v_rhs2);
254 }
255 
257 inline void V_InvMtV(
258  VectorMutable* v_lhs, const MatrixNonsing& M_rhs1
259  ,BLAS_Cpp::Transp trans_rhs1, const SpVectorSlice& sv_rhs2)
260 {
261  M_rhs1.V_InvMtV(v_lhs,trans_rhs1,sv_rhs2);
262 }
263 
266  const Vector& v_rhs1, const MatrixNonsing& M_rhs2
267  ,BLAS_Cpp::Transp trans_rhs2, const Vector& v_rhs3)
268 {
269  return M_rhs2.transVtInvMtV(v_rhs1,trans_rhs2,v_rhs3);
270 }
271 
274  const SpVectorSlice& sv_rhs1, const MatrixNonsing& M_rhs2
275  ,BLAS_Cpp::Transp trans_rhs2, const SpVectorSlice& sv_rhs3)
276 {
277  return M_rhs2.transVtInvMtV(sv_rhs1,trans_rhs2,sv_rhs3);
278 }
279 
280 // end Level-2 BLAS
281 //@ }
282 
284 //@ {
285 
287 inline void M_StInvMtM(
288  MatrixOp* m_lhs, value_type alpha
289  ,const MatrixNonsing& M_rhs1, BLAS_Cpp::Transp trans_rhs1
290  ,const MatrixOp& mwo_rhs2, BLAS_Cpp::Transp trans_rhs2 )
291 {
292  M_rhs1.M_StInvMtM(m_lhs,alpha,trans_rhs1,mwo_rhs2,trans_rhs2);
293 }
294 
296 inline void M_StMtInvM(
297  MatrixOp* m_lhs, value_type alpha
298  ,const MatrixOp& mwo_rhs1, BLAS_Cpp::Transp trans_rhs1
299  ,const MatrixNonsing& M_rhs2, BLAS_Cpp::Transp trans_rhs2 )
300 {
301  M_rhs2.M_StMtInvM(m_lhs,alpha,mwo_rhs1,trans_rhs1,trans_rhs2);
302 }
303 
304 // end Level-3 BLAS
305 //@ }
306 
307 // end Inline non-member operation functions
309 
310 } // end namespace AbstractLinAlgPack
311 
312 #endif // ABSTRACT_LINALG_PACK_MATRIX_NONSINGULAR_H
virtual mat_mns_mut_ptr_t clone_mns()
Clone the non-const matrix object (if supported).
Base class for all polymorphic matrices.
value_type transVtInvMtV(const Vector &v_rhs1, const MatrixNonsing &M_rhs2, BLAS_Cpp::Transp trans_rhs2, const Vector &v_rhs3)
result = v_rhs1' * inv(op(M_rhs2)) * v_rhs3
Abstract interface for immutable, finite dimensional, coordinate vectors {abstract}.
friend void V_InvMtV(VectorMutable *v_lhs, const MatrixNonsing &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2)
void M_StMtInvM(MatrixOp *m_lhs, value_type alpha, const MatrixOp &mwo_rhs1, BLAS_Cpp::Transp trans_rhs1, const MatrixNonsing &M_rhs2, BLAS_Cpp::Transp trans_rhs2)
m_lhs = alpha * op(mwo_rhs1) * inv(op(M_rhs2)) (left)
friend void M_StMtInvM(MatrixOp *m_lhs, value_type alpha, const MatrixOp &mwo_rhs1, BLAS_Cpp::Transp trans_rhs1, const MatrixNonsing &M_rhs2, BLAS_Cpp::Transp trans_rhs2)
void V_InvMtV(VectorMutable *v_lhs, const MatrixNonsing &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2)
v_lhs = inv(op(M_rhs1)) * v_rhs2
Base class for all matrices that support basic matrix operations.
friend value_type transVtInvMtV(const Vector &v_rhs1, const MatrixNonsing &M_rhs2, BLAS_Cpp::Transp trans_rhs2, const Vector &v_rhs3)
Abstract interface for mutable coordinate vectors {abstract}.
void M_StInvMtM(MatrixOp *m_lhs, value_type alpha, const MatrixNonsing &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const MatrixOp &mwo_rhs2, BLAS_Cpp::Transp trans_rhs2)
m_lhs = alpha * inv(op(mwo_rhs1)) * op(mwo_rhs2) (right)
This exception will be thrown if it turns out at runtime that the matrix is numerically singular...
friend void M_StInvMtM(MatrixOp *m_lhs, value_type alpha, const MatrixNonsing &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const MatrixOp &mwo_rhs2, BLAS_Cpp::Transp trans_rhs2)
Abstract base class for all nonsingular polymorphic matrices that can solve for linear system with bu...
Transp
TRANS.