46 #include "ConstrainedOptPack_MatrixHessianRelaxed.hpp"
47 #include "AbstractLinAlgPack/src/AbstractLinAlgPack_MatrixSymOp.hpp"
48 #include "AbstractLinAlgPack/src/AbstractLinAlgPack_GenPermMatrixSlice.hpp"
49 #include "AbstractLinAlgPack/src/AbstractLinAlgPack_SpVectorClass.hpp"
50 #include "AbstractLinAlgPack_SpVectorOp.hpp"
51 #include "DenseLinAlgPack_LinAlgOpPack.hpp"
53 namespace LinAlgOpPack {
58 namespace ConstrainedOptPack {
81 return n_ ? n_ + 1 : 0;
88 ,
const DVectorSlice& x, value_type b )
const
105 LinAlgOpPack::Vp_MtV_assert_sizes(y->size(),
rows(),
cols(),M_trans,x.size());
123 y2 = b*y2 + bigM_ * x2;
129 ,
const SpVectorSlice& x, value_type b )
const
146 LinAlgOpPack::Vp_MtV_assert_sizes(y->size(),
rows(),
cols(),M_trans,x.size());
154 const SpVectorSlice::element_type
155 *x2_ele = x.lookup_element(n_+1);
157 x2 = x2_ele ? x2_ele->value() : 0.0;
166 y2 = b*y2 + bigM_ * x2;
171 DVectorSlice* y, value_type a
174 ,
const DVectorSlice& x, value_type b )
const
178 namespace GPMSIP = AbstractLinAlgPack::GenPermMatrixSliceIteratorPack;
189 LinAlgOpPack::Vp_MtV_assert_sizes(y->size(),P.rows(),P.cols(),P_trans
191 LinAlgOpPack::Vp_MtV_assert_sizes(
BLAS_Cpp::cols( P.rows(), P.cols(), P_trans)
198 if( ( P.ordered_by() == GPMSIP::BY_ROW && P_trans ==
no_trans )
199 || ( P.ordered_by() == GPMSIP::BY_COL && P_trans ==
trans ) )
206 if( P.is_identity() )
209 const GenPermMatrixSlice
210 P1 = ( P.is_identity()
211 ? GenPermMatrixSlice( n_, n_, GenPermMatrixSlice::IDENTITY_MATRIX )
212 : P.create_submatrix(Range1D(1,n_),P_trans==
trans?GPMSIP::BY_ROW:GPMSIP::BY_COL)
214 P2 = ( P.is_identity()
215 ? GenPermMatrixSlice(
218 , GenPermMatrixSlice::ZERO_MATRIX )
219 : P.create_submatrix(Range1D(n_+1,n_+1),P_trans==
trans?GPMSIP::BY_ROW:GPMSIP::BY_COL)
232 i = P_trans ==
no_trans ? P2.begin()->row_i() : P2.begin()->col_j();
233 (*y)(i) += a * bigM_ * x2;
238 DVectorSlice* y, value_type a
241 ,
const SpVectorSlice& x, value_type b )
const
245 namespace GPMSIP = AbstractLinAlgPack::GenPermMatrixSliceIteratorPack;
256 LinAlgOpPack::Vp_MtV_assert_sizes(y->size(),P.rows(),P.cols(),P_trans
258 LinAlgOpPack::Vp_MtV_assert_sizes(
BLAS_Cpp::cols( P.rows(), P.cols(), P_trans)
265 if( ( P.ordered_by() == GPMSIP::BY_ROW && P_trans ==
no_trans )
266 || ( P.ordered_by() == GPMSIP::BY_COL && P_trans ==
trans ) )
273 if( P.is_identity() )
276 const GenPermMatrixSlice
277 P1 = ( P.is_identity()
278 ? GenPermMatrixSlice( n_, n_, GenPermMatrixSlice::IDENTITY_MATRIX )
279 : P.create_submatrix(Range1D(1,n_),P_trans==
trans?GPMSIP::BY_ROW:GPMSIP::BY_COL)
281 P2 = ( P.is_identity()
282 ? GenPermMatrixSlice(
285 , GenPermMatrixSlice::ZERO_MATRIX )
286 : P.create_submatrix(Range1D(n_+1,n_+1),P_trans==
trans?GPMSIP::BY_ROW:GPMSIP::BY_COL)
291 const SpVectorSlice::element_type
292 *x2_ele = x.lookup_element(n_+1);
294 x2 = x2_ele ? x2_ele->value() : 0.0;
301 i = P_trans ==
no_trans ? P2.begin()->row_i() : P2.begin()->col_j();
302 (*y)(i) += a * bigM_ * x2;
308 ,
const SpVectorSlice& x2 )
const
321 DenseLinAlgPack::Vp_MtV_assert_sizes(x1.size(),
rows(),
cols(),M_trans,x2.size());
327 const SpVectorSlice::element_type
328 *x12_ele = x1.lookup_element(n_+1);
330 x12 = x12_ele ? x12_ele->value() : 0.0;
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)
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)
MatrixHessianRelaxed()
Construct to uninitialized.
value_type transVtMtV(const Vector &v_rhs1, const MatrixOp &M_rhs2, BLAS_Cpp::Transp trans_rhs2, const Vector &v_rhs3)
void initialize(const MatrixSymOp &H, value_type bigM)
Initialize.
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 Vp_StMtV(DVectorSlice *vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const DVectorSlice &vs_rhs2, value_type beta) const
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
size_type cols(size_type rows, size_type cols, BLAS_Cpp::Transp _trans)
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
value_type transVtMtV(const SpVectorSlice &sv_rhs1, BLAS_Cpp::Transp trans_rhs2, const SpVectorSlice &sv_rhs3) const