44 #include "ConstrainedOptPack_MatrixSymPosDefInvCholFactor.hpp"
45 #include "SymInvCholMatrixOp.hpp"
46 #include "AbstractLinAlgPack_SpVectorOp.hpp"
47 #include "DenseLinAlgPack_DVectorOp.hpp"
48 #include "DenseLinAlgPack_LinAlgOpPack.hpp"
49 #include "DenseLinAlgPack_DMatrixOp.hpp"
50 #include "DenseLinAlgPack_DMatrixOut.hpp"
52 namespace LinAlgOpPack {
61 namespace ConstrainedOptPack {
65 size_type MatrixSymPosDefInvCholFactor::cols()
const
74 return MatrixWithOpConcreteEncap<SymInvCholMatrix>::operator=(m);
78 {
return out <<
"\n*** Inverse Cholesky factor:\n" << m().UInv(); }
83 ,
const DVectorSlice& vs_rhs2, value_type beta)
const
89 ,
const SpVectorSlice& sv_rhs2, value_type beta)
const
98 ,
const DVectorSlice& vs_rhs3)
const
104 ,
const SpVectorSlice& sv_rhs3)
const
107 DVector vs_rhs1, vs_rhs3;
116 ,
const DVectorSlice& vs_rhs2)
const
122 ,
const DVectorSlice& vs_rhs2)
const
128 ,
const SpVectorSlice& sv_rhs2)
const
134 ,
const SpVectorSlice& sv_rhs2)
const
153 DMatrixSliceSym* S, value_type a,
const MatrixOp& B
162 using BLAS_Cpp::upper;
163 using BLAS_Cpp::nonunit;
165 using DenseLinAlgPack::tri;
168 using LinAlgOpPack::M_StMtM;
171 DenseLinAlgPack::MtM_assert_sizes(
rows(), cols(),
no_trans
172 , B.rows(), B.cols(),
trans_not(B_trans) );
173 DenseLinAlgPack::Mp_MtM_assert_sizes( S->rows(), S->cols(),
no_trans
174 , B.rows(), B.cols(), B_trans
175 , B.rows(), B.cols(),
trans_not(B_trans) );
195 M_StMtM( &T(), 1.0, tri(m().UInv(),upper,nonunit),
trans, T(),
no_trans );
205 std::ostringstream omsg;
206 omsg <<
"MatrixSymPosDefInvCholFactor::init_identity(...) : Error, alpha = " << alpha
207 <<
" <= 0.0 and therefore this is not a positive definite matrix.";
208 throw UpdateSkippedException( omsg.str() );
212 m().UInv().diag() = 1.0 / ::sqrt( alpha );
217 DVectorSlice::const_iterator
218 min_ele_ptr = std::min_element( diag.begin(), diag.end() );
219 if( *min_ele_ptr <= 0.0 ) {
220 std::ostringstream omsg;
221 omsg <<
"MatrixSymPosDefInvCholFactor::init_diagonal(...) : Error, "
222 <<
"diag(" << min_ele_ptr - diag.begin() + 1 <<
" ) = "
223 << (*min_ele_ptr) <<
" <= 0.0.\n"
224 <<
"Therefore this is not a positive definite matrix.";
225 throw UpdateSkippedException( omsg.str() );
231 DVectorSlice::const_iterator
232 diag_itr = diag.begin();
233 DVectorSlice::iterator
234 inv_fact_diag_itr = m().UInv().diag().begin();
236 while( diag_itr != diag.end() )
237 *inv_fact_diag_itr++ = 1.0 / ::sqrt( *diag_itr++ );
242 using LinAlgOpPack::V_MtV;
247 ConstrainedOptPack::BFGS_update(&m(),s,y,&Bs());
250 ConstrainedOptPack::BFGS_update(&m(),s,y,_Bs);
253 catch(
const BFGSUpdateSkippedException& excpt) {
254 throw UpdateSkippedException( excpt.what() );
value_type transVtInvMtV(const Vector &v_rhs1, const MatrixNonsing &M_rhs2, BLAS_Cpp::Transp trans_rhs2, const Vector &v_rhs3)
void M_StMtInvMtM(DMatrixSliceSym *sym_gms_lhs, value_type alpha, const MatrixOp &mwo, BLAS_Cpp::Transp mwo_trans, EMatrixDummyArg) const
void init_diagonal(const DVectorSlice &diag)
void Vp_StV(VectorMutable *v_lhs, const value_type &alpha, const Vector &v_rhs)
size_type rows(size_type rows, size_type cols, BLAS_Cpp::Transp _trans)
MatrixOp & operator=(const MatrixOp &m)
void serialize(std::ostream &out) const
void secant_update(DVectorSlice *s, DVectorSlice *y, DVectorSlice *Bs)
void Vp_StMtV(DVectorSlice *vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const DVectorSlice &vs_rhs2, value_type beta) const
value_type transVtMtV(const DVectorSlice &vs_rhs1, BLAS_Cpp::Transp trans_rhs2, const DVectorSlice &vs_rhs3) const
value_type transVtMtV(const Vector &v_rhs1, const MatrixOp &M_rhs2, BLAS_Cpp::Transp trans_rhs2, const Vector &v_rhs3)
void assign(MatrixOp *M_lhs, const MatrixOp &M_rhs, BLAS_Cpp::Transp trans_rhs)
std::ostream & output(std::ostream &out) const
value_type transVtInvMtV(const DVectorSlice &vs_rhs1, BLAS_Cpp::Transp trans_rhs2, const DVectorSlice &vs_rhs3) const
void syrk(const MatrixOp &mwo_rhs, BLAS_Cpp::Transp M_trans, value_type alpha, value_type beta, MatrixSymOp *sym_lhs)
void V_InvMtV(VectorMutable *v_lhs, const MatrixNonsing &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2)
void Mp_StM(MatrixOp *mwo_lhs, value_type alpha, const MatrixOp &M_rhs, BLAS_Cpp::Transp trans_rhs)
void Vp_StMtV(VectorMutable *v_lhs, value_type alpha, const MatrixOp &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2, value_type beta=1.0)
void extract_inv_chol(DMatrixSliceTriEle *InvChol) const
void init_identity(size_type n, value_type alpha)
Transp trans_not(Transp _trans)
void V_InvMtV(DVector *v_lhs, BLAS_Cpp::Transp trans_rhs1, const DVectorSlice &vs_rhs2) const
void unserialize(std::istream &in)
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)
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)