46 #include "AbstractLinAlgPack/src/AbstractLinAlgPack_MatrixSymOp.hpp"
48 #include "AbstractLinAlgPack/src/AbstractLinAlgPack_GenPermMatrixSlice.hpp"
51 #include "Midynamic_cast_verbose.h"
52 #include "MiWorkspacePack.h"
53 #include "Miprofile_hack.h"
55 namespace LinAlgOpPack {
59 namespace ConstrainedOptPack {
74 ,i_x_fixed_t* i_x_fixed
75 ,bnd_fixed_t* bnd_fixed
76 ,j_f_decomp_t* j_f_decomp
84 namespace rcp = MemMngPack;
88 #ifdef PROFILE_HACK_ENABLED
95 G_sym =
dynamic_cast<const MatrixSymOp&
>(G);
98 G_sym =
dyn_cast<
const MatrixSymOp>(G);
104 Workspace<EBounds> x_frfx(wss,nd);
105 std::fill_n( &x_frfx[0], nd,
FREE );
112 dL.begin(), dL.end(), dL.offset(),
113 dU.begin(), dU.end(), dU.offset(), inf_bnd );
114 SpVectorSlice::const_iterator
117 const SpVector::difference_type o = nu.offset();
118 while( !dLU_itr.at_end() || nu_itr != nu_end ) {
119 if( dLU_itr.at_end() ) {
120 for( ; nu_itr != nu_end; ++num_init_fixed, ++nu_itr )
121 x_frfx[nu_itr->indice() + o - 1] = ( nu_itr->value() > 0.0 ?
UPPER :
LOWER );
125 for( ; nu_itr != nu_end && nu_itr->indice() + o < dLU_itr.indice(); ++num_init_fixed, ++nu_itr )
126 x_frfx[nu_itr->indice() + o - 1] = ( nu_itr->value() > 0.0 ?
UPPER :
LOWER );
127 if( dLU_itr.lbound() == dLU_itr.ubound() ) {
129 x_frfx[dLU_itr.indice() - 1] =
EQUALITY;
132 if( nu_itr != nu_end && nu_itr->indice() + o == dLU_itr.indice() )
142 *n_R = nd - num_init_fixed;
145 i_x_free->resize(*n_R);
146 i_x_fixed->resize(num_init_fixed+1);
147 bnd_fixed->resize(num_init_fixed+1);
148 b_X->
resize(num_init_fixed+1);
153 dL.begin(), dL.end(), dL.offset(),
154 dU.begin(), dU.end(), dU.offset(), inf_bnd );
159 if( bnd_i ==
FREE ) {
160 (*i_x_free)[i_R] = i;
164 (*i_x_fixed)[i_X] = i;
165 (*bnd_fixed)[i_X] = bnd_i;
167 while( dLU_itr.indice() < i )
174 b_X_val = dLU_itr.lbound();
177 b_X_val = dLU_itr.ubound();
182 (*b_X)[i_X] = b_X_val;
186 (*i_x_fixed)[i_X] = nd+1;
187 (*bnd_fixed)[i_X] =
LOWER;
193 j_f_decomp->resize(0);
199 Q_X_row_i(wss,num_init_fixed),
200 Q_X_col_j(wss,num_init_fixed);
204 *n_R,num_init_fixed,&(*i_x_free)[0],&(*i_x_fixed)[0],
false
205 ,&Q_R_row_i[0],&Q_R_col_j[0],&Q_R
206 ,&Q_X_row_i[0],&Q_X_col_j[0],&Q_X
217 &sym_G_RR_dense, 1.0, MatrixSymOp::DUMMY_ARG
222 G_RR_ptr =
new MatrixSymPosDefCholFactor();
223 G_RR_ptr->initialize(sym_G_RR_dense);
232 if( num_init_fixed ) {
Iterate through a set of sparse bounds.
AbstractLinAlgPack::size_type size_type
SparseVector< SparseElement< index_type, value_type >, std::allocator< SparseElement< index_type, value_type > > > SpVector
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)
v_lhs = alpha * op(P_rhs1) * op(M_rhs2) * v_rhs3 + beta * v_rhs
int resize(OrdinalType length_in)
Helper class that takes care of timing.
void V_StMtV(VectorMutable *v_lhs, value_type alpha, const MatrixOp &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const V &V_rhs2)
v_lhs = alpha * op(M_rhs1) * V_rhs2.
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)
mwo_lhs += alpha * op(P_rhs1) * op(M_rhs) * op(P_rhs2).
const MatrixSymOpNonsing element_type
void V_mV(VectorMutable *v_lhs, const V &V_rhs)
v_lhs = - V_rhs.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
T_To & dyn_cast(T_From &from)
void initialize_Q_R_Q_X(size_type n_R, size_type n_X, const size_type i_x_free[], const size_type i_x_fixed[], bool test_setup, size_type Q_R_row_i[], size_type Q_R_col_j[], GenPermMatrixSlice *Q_R, size_type Q_X_row_i[], size_type Q_X_col_j[], GenPermMatrixSlice *Q_X)
Initialize GenPermMatrixSlice mapping matrices for Q_R and Q_X.
void initialize_kkt_system(const DVectorSlice &g, const MatrixOp &G, value_type etaL, const SpVectorSlice &dL, const SpVectorSlice &dU, const MatrixOp *F, BLAS_Cpp::Transp trans_F, const DVectorSlice *f, const DVectorSlice &d, const SpVectorSlice &nu, size_type *n_R, i_x_free_t *i_x_free, i_x_fixed_t *i_x_fixed, bnd_fixed_t *bnd_fixed, j_f_decomp_t *j_f_decomp, DVector *b_X, Ko_ptr_t *Ko, DVector *fo) const
Initialize the KKT system where initially fixed variables are removed and no equality constraints are...
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)
v_lhs = alpha * op(M_rhs1) * v_rhs2 + beta * v_lhs (BLAS xGEMV)
SparseVectorSlice< SparseElement< index_type, value_type > > SpVectorSlice
DenseLinAlgPack::VectorSliceTmpl< value_type > DVectorSlice
AbstractLinAlgPack::value_type value_type
DenseLinAlgPack::DMatrixSliceSym DMatrixSliceSym
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
TEUCHOSCORE_LIB_DLL_EXPORT Teuchos::RCP< WorkspaceStore > get_default_workspace_store()
void V_MtV(DVector &v_lhs, const T_Matrix &gm_rhs1, BLAS_Cpp::Transp trans_rhs1, const DVectorSlice &vs_rhs2)
v_lhs = T_M * vs_lhs (templated matrix type T_M)