44 #include "ConstrainedOptPack_MatrixSymHessianRelaxNonSing.hpp" 45 #include "AbstractLinAlgPack_VectorDenseEncap.hpp" 46 #include "AbstractLinAlgPack_LinAlgOpPackHack.hpp" 47 #include "AbstractLinAlgPack_SpVectorClass.hpp" 48 #include "AbstractLinAlgPack_GenPermMatrixSlice.hpp" 49 #include "AbstractLinAlgPack_VectorSpaceBlocked.hpp" 50 #include "AbstractLinAlgPack_LinAlgOpPack.hpp" 51 #include "DenseLinAlgPack_AssertOp.hpp" 52 #include "DenseLinAlgPack_LinAlgOpPack.hpp" 53 #include "ProfileHackPack_profile_hack.hpp" 54 #include "Teuchos_Assert.hpp" 61 DenseLinAlgPack::DVectorSlice* y, DenseLinAlgPack::value_type a
64 ,
const V& x, DenseLinAlgPack::value_type b
77 TEUCHOS_TEST_FOR_EXCEPT(y==NULL);
86 DenseLinAlgPack::Vp_MtV_assert_sizes(
89 DenseLinAlgPack::Vp_MtV_assert_sizes(
91 ,nd, nd, H_trans, x.dim() );
111 TEUCHOS_TEST_FOR_EXCEPT(
true);
114 const DenseLinAlgPack::Range1D
119 ? GenPermMatrixSlice(
122 ,GenPermMatrixSlice::IDENTITY_MATRIX )
123 : P.create_submatrix(o_rng,P_trans==
trans?GPMSIP::BY_ROW:GPMSIP::BY_COL)
125 P2 = ( P.is_identity()
126 ? GenPermMatrixSlice(
129 ,GenPermMatrixSlice::ZERO_MATRIX )
130 : P.create_submatrix(r_rng,P_trans==
trans?GPMSIP::BY_ROW:GPMSIP::BY_COL)
150 : vec_space_(Teuchos::null)
158 : vec_space_(Teuchos::null)
171 const char err_msg_head[] =
"MatrixSymHessianRelaxNonSing::initialize(...) : Error!";
172 TEUCHOS_TEST_FOR_EXCEPTION(G_ptr.get()==NULL, std::invalid_argument, err_msg_head);
173 TEUCHOS_TEST_FOR_EXCEPTION(M_diag_ptr.get()==NULL, std::invalid_argument, err_msg_head);
174 const size_type G_rows = G_ptr->rows(), M_diag_dim = M_diag_ptr->dim();
175 TEUCHOS_TEST_FOR_EXCEPTION(G_rows==0, std::invalid_argument, err_msg_head);
176 TEUCHOS_TEST_FOR_EXCEPTION(M_diag_dim==0, std::invalid_argument, err_msg_head);
180 const size_type space_dim = space->dim();
181 TEUCHOS_TEST_FOR_EXCEPTION(space_dim != G_rows + M_diag_dim, std::invalid_argument, err_msg_head);
186 VectorSpace::space_ptr_t spaces[]
187 = { Teuchos::rcp(&G_ptr->space_cols(),
false), Teuchos::rcp(&M_diag_ptr->space(),
false) };
188 vec_space_ = Teuchos::rcp(
new VectorSpaceBlocked( spaces, 2 ) );
191 M_.initialize(M_diag_ptr);
198 assert_initialized();
206 #ifdef PROFILE_HACK_ENABLED 209 assert_initialized();
222 ,
const Vector& x, value_type b
225 #ifdef PROFILE_HACK_ENABLED 228 assert_initialized();
239 ,
const SpVectorSlice& x, value_type b
242 #ifdef PROFILE_HACK_ENABLED 245 assert_initialized();
255 VectorMutable* y, value_type a,
const GenPermMatrixSlice& P,
BLAS_Cpp::Transp P_trans
259 #ifdef PROFILE_HACK_ENABLED 262 assert_initialized();
266 Vp_StPtMtV_imp(&y_d(),a,P,P_trans,*
this,H_trans,x_d(),b);
270 VectorMutable* y, value_type a,
const GenPermMatrixSlice& P,
BLAS_Cpp::Transp P_trans
274 #ifdef PROFILE_HACK_ENABLED 277 assert_initialized();
280 Vp_StPtMtV_imp(&y_d(),a,P,P_trans,*
this,H_trans,x,b);
286 MatrixSymOp* S, value_type a
296 #ifdef PROFILE_HACK_ENABLED 299 assert_initialized();
376 #ifdef PROFILE_HACK_ENABLED 379 assert_initialized();
391 #ifdef PROFILE_HACK_ENABLED 394 assert_initialized();
404 void MatrixSymHessianRelaxNonSing::assert_initialized()
const 406 TEUCHOS_TEST_FOR_EXCEPTION(
407 G_ptr_.get() == NULL, std::logic_error
408 ,
"MatrixSymHessianRelaxNonSing::assert_initialized(): Error, Not initalized yet!" );
void V_InvMtV(VectorMutable *v_lhs, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2) const
void Vt_S(VectorMutable *v_lhs, const value_type &alpha)
Teuchos::RCP< VectorMutable > vec_mut_ptr_t
void Vp_StPtMtV(VectorMutable *v_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, const MatrixOp &M_rhs2, BLAS_Cpp::Transp M_rhs2_trans, const Vector &v_rhs3, value_type beta=1.0)
const vec_mut_ptr_t & M_diag_ptr() const
size_type rows(size_type rows, size_type cols, BLAS_Cpp::Transp _trans)
Teuchos::RCP< const VectorSpace > space_ptr_t
void initialize(const G_ptr_t &G_ptr, const vec_mut_ptr_t &M_diag_ptr, const space_ptr_t &space=Teuchos::null)
Initialize the Hessian and the relaxation terms.
void Mp_StPtMtP(MatrixOp *mwo_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, const MatrixOp &M_rhs, BLAS_Cpp::Transp trans_rhs, const GenPermMatrixSlice &P_rhs2, BLAS_Cpp::Transp P_rhs2_trans)
void Mp_StPtMtP(MatrixSymOp *sym_lhs, value_type alpha, EMatRhsPlaceHolder dummy_place_holder, const GenPermMatrixSlice &gpms_rhs, BLAS_Cpp::Transp gpms_rhs_trans, value_type beta) const
Matrix class for non-singular Hessian matrix augmented with a terms for "Big M" relaxation variables...
const VectorSpace & space_cols() const
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)
const G_ptr_t & G_ptr() const
Transp trans_not(Transp _trans)
void Vp_StMtV(VectorMutable *v_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2, value_type beta) const
const AbstractLinAlgPack::MatrixSymDiagStd & M() const
Teuchos::RCP< const MatrixSymOpNonsing > G_ptr_t
void Vp_StPtMtV(VectorMutable *v_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, BLAS_Cpp::Transp M_rhs2_trans, const Vector &v_rhs3, value_type beta) const
size_type cols(size_type rows, size_type cols, BLAS_Cpp::Transp _trans)
EOrderedBy ordered_by() const
bool Mp_StM(MatrixOp *mwo_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs) const
const MatrixSymOpNonsing & G() const
MatrixSymHessianRelaxNonSing()
Construct uninitialized.