MOOCHO (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AbstractLinAlgPack_MatrixSymDiagStd.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 MATRIX_SYM_DIAGONAL_STD_H
43 #define MATRIX_SYM_DIAGONAL_STD_H
44 
48 
49 namespace AbstractLinAlgPack {
50 
58  : public virtual MatrixSymInitDiag
59  , public virtual MatrixSymDiag
60 {
61 public:
62 
65  class PostMod {
66  public:
68  : vectorSpace_(vectorSpace) {}
69 
70  void initialize(MatrixSymDiagStd* matrix) const
71  { matrix->initialize(vectorSpace_->create_member()); }
72 
73  private:
75 
76  }; // end PostMod
77 
78 
81 
85  ,bool unique = true
86  );
87 
95  void initialize(
97  ,bool unique = true
98  );
99 
101 
104 
113  VectorMutable& diag();
115  const VectorSpace::vec_mut_ptr_t& diag_ptr() const;
117  bool unique() const;
118 
120 
123 
125  size_type rows() const;
127  size_type nz() const;
128 
130 
133 
135  const VectorSpace& space_rows() const;
137  const VectorSpace& space_cols() const;
139  MatrixOp& operator=(const MatrixOp& mwo_rhs);
146  bool Mp_StM(MatrixOp* g_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs) const;
148  void Vp_StMtV(VectorMutable* v_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1
149  , const Vector& v_rhs2, value_type beta) const;
151  void Vp_StMtV(VectorMutable* v_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1
152  , const SpVectorSlice& sv_rhs2, value_type beta) const;
158  bool syrk(
159  BLAS_Cpp::Transp M_trans
160  ,value_type alpha
161  ,value_type beta
162  ,MatrixSymOp *sym_lhs
163  ) const;
164 
166 
169 
171  void V_InvMtV(VectorMutable* v_lhs, BLAS_Cpp::Transp trans_rhs1
172  , const Vector& v_rhs2) const;
174  void V_InvMtV(VectorMutable* v_lhs, BLAS_Cpp::Transp trans_rhs1
175  , const SpVectorSlice& sv_rhs2) const;
176 
178 
181 
183  void init_identity( const VectorSpace& space_diag, value_type alpha );
185  void init_diagonal( const Vector& diag );
186 
188 
191 
193  const Vector& diag() const;
194 
196 
197 private:
198 
200  bool unique_;
201 
202  void copy_unique();
203 
204 }; // end class MatrixSymDiagStd
205 
206 // ////////////////////////////////////////
207 // Inline members
208 
209 inline
211 {
212  return unique_;
213 }
214 
215 } // end namespace AbstractLinAlgPack
216 
217 #endif // MATRIX_SYM_DIAGONAL_STD_H
Mix-in Interface for setting a matrix to a diagonal {abstract}.
Abstract interface for immutable, finite dimensional, coordinate vectors {abstract}.
MatrixSymDiagStd(const VectorSpace::vec_mut_ptr_t &diag=Teuchos::null, bool unique=true)
Calls this->initialize().
PostMod class to use with MemMngPack::AbstractFactorStd.
void Vp_StMtV(VectorMutable *v_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2, value_type beta) const
bool Mp_StM(MatrixOp *g_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs) const
Add to a mutable matrix lhs.
Interface adding operations specific for a symmetric matrix {abstract}.
bool syrk(BLAS_Cpp::Transp M_trans, value_type alpha, value_type beta, MatrixSymOp *sym_lhs) const
Implements the symmetric rank-k update for all diagonal matrix lhs.
Abstract interface for objects that represent a space for mutable coordinate vectors.
void initialize(const VectorSpace::vec_mut_ptr_t &diag, bool unique=true)
Initialize given the diagonal vector (or no vector at all).
Base class for all matrices that support basic matrix operations.
Interface to all diagonal matrices {abstract}.
const VectorSpace::vec_mut_ptr_t & diag_ptr() const
void V_InvMtV(VectorMutable *v_lhs, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2) const
void init_identity(const VectorSpace &space_diag, value_type alpha)
Abstract interface for mutable coordinate vectors {abstract}.
size_type rows() const
Returns 0 if not initalized (this->diag() == NULL).
Transp
TRANS.
VectorMutable & diag()
Give non-const access to the diagonal vector.