MOOCHO (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ConstrainedOptPack_MatrixSymPosDefBandedChol.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_POS_DEF_BANDED_CHOL_H
43 #define MATRIX_SYM_POS_DEF_BANDED_CHOL_H
44 
46 #include "AbstractLinAlgPack/src/MatrixSymWithOpFactorized.hpp"
48 #include "Miref_count_ptr.h"
49 #include "MiReleaseResource.h"
50 
51 namespace ConstrainedOptPack {
78 class MatrixSymPosDefBandedChol : public MatrixSymWithOpFactorized
79 {
80 public:
81 
83  typedef Teuchos::RCP<
85 
86  // //////////////
87  // Constructors
88 
94  size_type n = 0
95  ,size_type kd = 0
96  ,DMatrixSlice *MB = NULL
97  ,const release_resource_ptr_t& MB_release_resource_ptr = NULL
99  ,DMatrixSlice *UB = NULL
100  ,const release_resource_ptr_t& UB_release_resource_ptr = NULL
102  ,bool update_factor = false
103  ,value_type scale = 1.0
104  );
105 
106  // ///////////////////////////
107  // Access representation
108 
141  void initialize(
142  size_type n = 0
143  ,size_type kd = 0
144  ,DMatrixSlice *MB = NULL
145  ,const release_resource_ptr_t& MB_release_resource_ptr = NULL
147  ,DMatrixSlice *UB = NULL
148  ,const release_resource_ptr_t& UB_release_resource_ptr = NULL
150  ,bool update_factor = false
151  ,value_type scale = 1.0
152  );
153 
155  size_type kd() const;
158  DMatrixSlice& MB();
160  const DMatrixSlice& MB() const;
162  BLAS_Cpp::Uplo MB_uplo() const;
165  DMatrixSlice& UB();
167  const DMatrixSlice& UB() const;
169  BLAS_Cpp::Uplo UB_uplo() const;
170 
171  // /////////////////////////////
172  // Overridden from MatrixOp
173 
175  size_type rows() const;
177  size_type nz() const;
179  std::ostream& output(std::ostream& out) const;
181  void Vp_StMtV(DVectorSlice* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1
182  , const DVectorSlice& vs_rhs2, value_type beta) const;
184  void Vp_StMtV(DVectorSlice* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1
185  , const SpVectorSlice& sv_rhs2, value_type beta) const;
187  void Vp_StPtMtV(DVectorSlice* vs_lhs, value_type alpha
188  , const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans
189  , BLAS_Cpp::Transp M_rhs2_trans
190  , const DVectorSlice& vs_rhs3, value_type beta) const;
192  void Vp_StPtMtV(DVectorSlice* vs_lhs, value_type alpha
193  , const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans
194  , BLAS_Cpp::Transp M_rhs2_trans
195  , const SpVectorSlice& sv_rhs3, value_type beta) const;
196 
197  // //////////////////////////////////
198  // Overridden from MatrixFactorized
199 
201  void V_InvMtV(DVectorSlice* vs_lhs, BLAS_Cpp::Transp trans_rhs1
202  , const DVectorSlice& vs_rhs2) const;
203 
204 private:
205 
206  // /////////////////////////////
207  // Private data members
208 
214  mutable DMatrixSlice UB_;
217  mutable bool factor_updated_;
219 
220  // /////////////////////////////
221  // Private member functions
222 
223  void assert_initialized() const;
224  void update_factorization() const;
225 
226 }; // end class MatrixSymPosDefBandedChol
227 
228 // ///////////////////////////////////////////////////////
229 // Inline members for MatrixSymPosDefBandedChol
230 
231 inline
233 {
234  return kd_;
235 }
236 
237 inline
239 {
240  return MB_;
241 }
242 
243 inline
245 {
246  return MB_;
247 }
248 
249 inline
251 {
252  return MB_uplo_;
253 }
254 
255 inline
257 {
258  return UB_;
259 }
260 
261 inline
263 {
264  return UB_;
265 }
266 
267 inline
269 {
270  return UB_uplo_;
271 }
272 
273 } // end namespace ConstrainedOptPack
274 
275 #endif // MATRIX_SYM_POS_DEF_BANDED_CHOL_H
void Vp_StPtMtV(DVectorSlice *vs_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, BLAS_Cpp::Transp M_rhs2_trans, const DVectorSlice &vs_rhs3, value_type beta) const
AbstractLinAlgPack::size_type size_type
std::ostream & output(std::ostream &out) const
void Vp_StMtV(DVectorSlice *vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const DVectorSlice &vs_rhs2, value_type beta) const
void V_InvMtV(DVectorSlice *vs_lhs, BLAS_Cpp::Transp trans_rhs1, const DVectorSlice &vs_rhs2) const
With throw exception if factorization is not allowed.
void initialize(size_type n=0, size_type kd=0, DMatrixSlice *MB=NULL, const release_resource_ptr_t &MB_release_resource_ptr=NULL, BLAS_Cpp::Uplo MB_uplo=BLAS_Cpp::lower, DMatrixSlice *UB=NULL, const release_resource_ptr_t &UB_release_resource_ptr=NULL, BLAS_Cpp::Uplo UB_uplo=BLAS_Cpp::lower, bool update_factor=false, value_type scale=1.0)
Initialize.
Abstract interface for releasing an object when it is not needed anymore {abstract}.
std::ostream * out
Matrix subclass for banded symmetric positive definite matrices and their Cholesky factors...
SparseVectorSlice< SparseElement< index_type, value_type > > SpVectorSlice
DenseLinAlgPack::VectorSliceTmpl< value_type > DVectorSlice
MatrixSymPosDefBandedChol(size_type n=0, size_type kd=0, DMatrixSlice *MB=NULL, const release_resource_ptr_t &MB_release_resource_ptr=NULL, BLAS_Cpp::Uplo MB_uplo=BLAS_Cpp::lower, DMatrixSlice *UB=NULL, const release_resource_ptr_t &UB_release_resource_ptr=NULL, BLAS_Cpp::Uplo UB_uplo=BLAS_Cpp::lower, bool update_factor=false, value_type scale=1.0)
Construct and Initialize.
AbstractLinAlgPack::value_type value_type
DenseLinAlgPack::DMatrixSlice DMatrixSlice
Transp
TRANS.