MOOCHO (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ConstrainedOptPack_MatrixSymIdentitySerial.cpp
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 #include <assert.h>
43 
44 #include <limits>
45 
52 
53 namespace ConstrainedOptPack {
54 
55 // Constructors
56 
58 {
59  this->initialize(size,scale);
60 }
61 
63 {
64  size_ = size;
65  scale_ = scale;
66 }
67 
68 // Overridden from MatrixBase
69 
71 {
72  return size_;
73 }
74 
76 {
77  return size_;
78 }
79 
80 // Overridden from MatrixOp
81 
82 std::ostream& MatrixSymIdentitySerial::output(std::ostream& out) const
83 {
84  out << "Identity matrix of size " << size_ << " x " << size_ << std::endl;
85  return out;
86 }
87 
88 // Overridden from MatrixOpSerial
89 
92  ,const DVectorSlice& x, value_type b
93  ) const
94 {
98 }
99 
100 // Overridden from MatrixNonsinguarSerial
101 
103  DVectorSlice* y, BLAS_Cpp::Transp M_trans, const DVectorSlice& x
104  ) const
105 {
108 }
109 
110 // Overridden from MatrixSymNonsing
111 
114  ,const MatrixOpSerial& B, BLAS_Cpp::Transp B_trans
115  ,EMatrixDummyArg dummy_arg
116  ) const
117 {
118  this->MatrixSymNonsingSerial::M_StMtInvMtM(S,a,B,B_trans,dummy_arg);
119  // ToDo: Implement by calling S = b*S + scale*a*op(B')*op(B)
120 }
121 
122 // Overridden from MatrixExtractInvCholFactor
123 
125 {
126  if( scale_ < 0.0 )
127  throw std::logic_error(
128  "MatrixSymIdentitySerial::extract_inv_chol(...) : "
129  "Error, we can not compute the inverse cholesky factor "
130  "of a negative definite matrix." );
131  DenseLinAlgPack::assign( &InvChol->gms(), 0.0 );
132  InvChol->gms().diag() = 1.0 / std::sqrt(scale_);
133 }
134 
135 } // end namespace ConstrainedOptPack
AbstractLinAlgPack::size_type size_type
void Vp_StMtV(DVectorSlice *vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const DVectorSlice &vs_rhs2, value_type beta) const
void Vp_StV(DVectorSlice *vs_lhs, value_type alpha, const DVectorSlice &vs_rhs)
vs_lhs += alpha * vs_rhs (BLAS xAXPY)
void assign(DMatrix *gm_lhs, value_type alpha)
gm_lhs = alpha (elementwise)
void M_StMtInvMtM(DMatrixSliceSym *sym_gms_lhs, value_type alpha, const MatrixOpSerial &mwo, BLAS_Cpp::Transp mwo_trans, EMatrixDummyArg) const
void V_StV(VectorMutable *v_lhs, value_type alpha, const V &V_rhs)
v_lhs = alpha * V_rhs.
void V_InvMtV(DVectorSlice *vs_lhs, BLAS_Cpp::Transp trans_rhs1, const DVectorSlice &vs_rhs2) const
Not transposed.
virtual size_type cols() const
Return the number of columns in the matrix.
std::ostream * out
DenseLinAlgPack::DMatrixSliceTriEle DMatrixSliceTriEle
MatrixSymIdentitySerial(size_type size=1, value_type scale=1.0)
Calls this->initalize()
f_dbl_prec f_dbl_prec f_dbl_prec * S
void sqrt(DVectorSlice *vs_lhs, const DVectorSlice &vs_rhs)
vs_lhs = sqrt(vs_rhs)
DenseLinAlgPack::VectorSliceTmpl< value_type > DVectorSlice
void Vt_S(DVectorSlice *vs_lhs, value_type alpha)
vs_lhs *= alpha (BLAS xSCAL) (*** Note that alpha == 0.0 is handeled as vs_lhs = 0.0)
AbstractLinAlgPack::value_type value_type
void Vp_MtV_assert_sizes(size_type v_lhs_size, size_type m_rhs1_rows, size_type m_rhs1_cols, BLAS_Cpp::Transp trans_rhs1, size_type v_rhs2_size)
v_lhs += op(m_rhs1) * v_rhs2
void M_StMtInvMtM(MatrixSymOp *sym_gms_lhs, value_type alpha, const MatrixOp &mwo, BLAS_Cpp::Transp mwo_trans, const MatrixSymNonsing &mswof, MatrixSymNonsing::EMatrixDummyArg mwo_rhs)
sym_gms_lhs = alpha * op(mwo) * inv(mswof) * op(mwo)'
DenseLinAlgPack::DMatrixSliceSym DMatrixSliceSym
Transp
TRANS.