47 #include "AbstractLinAlgPack/src/AbstractLinAlgPack_SpVectorClass.hpp"
49 #include "AbstractLinAlgPack/src/AbstractLinAlgPack_MatrixOpOut.hpp"
54 namespace LinAlgOpPack {
58 namespace ConstrainedOptPack {
70 ,
const B_RR_ptr_t& B_RR_ptr
71 ,
const B_RX_ptr_t& B_RX_ptr
73 ,
const B_XX_ptr_t& B_XX_ptr
85 if( 0 < n_R && n_R < n && i_x_free == NULL ) {
86 throw std::invalid_argument(
87 "MatrixHessianSuperBasic::initialize(...) : Error, "
88 "i_x_free can not be NULL when 0 < n_R < n" );
91 if( 0 < n_X && n_X < n && i_x_fixed == NULL ) {
92 throw std::invalid_argument(
93 "MatrixHessianSuperBasic::initialize(...) : Error, "
94 "i_x_fixed can not be NULL when 0 < n-n_R < n" );
97 if( 0 < n_X && bnd_fixed == NULL ) {
98 throw std::invalid_argument(
99 "MatrixHessianSuperBasic::initialize(...) : Error, "
100 "bnd_fixed can not be NULL when 0 < n-n_R" );
104 if( !B_RR_ptr.get() )
105 throw std::invalid_argument(
106 "MatrixHessianSuperBasic::initialize(...) : Error, "
107 "B_RR_ptr.get() can not be NULL when n_R > 0" );
112 if( B_RX_ptr.get() ) {
118 if( !B_XX_ptr.get() )
119 throw std::invalid_argument(
120 "MatrixHessianSuperBasic::initialize(...) : Error, "
121 "B_XX_ptr.get() can not be NULL if n_R < n" );
126 const bool Q_R_is_idenity = (n_R == n && i_x_fixed == NULL );
127 if( Q_R_is_idenity ) {
137 bool test_setup =
true;
139 n_R,n_X,i_x_free,i_x_fixed,test_setup
189 if(
Q_R().is_identity() ) {
198 else if(
n_R_ == 0 ) {
261 if(
Q_R().is_identity() ) {
270 else if(
n_R_ == 0 ) {
327 namespace slap = AbstractLinAlgPack;
370 else if(b!=1.0)
Vt_S(y,b);
374 if( P_Q_R_nz && Q_RT_x.nz() ) {
380 if( P_Q_R_nz &&
B_RX_ptr().
get() && Q_XT_x.nz() ) {
386 if( P_Q_X_nz &&
B_RX_ptr().
get() && Q_RT_x.nz() ) {
392 if( P_Q_X_nz && Q_XT_x.nz() ) {
413 if(
Q_R().is_identity() ) {
434 else if(
n_R_ == 0 ) {
476 Q_XT_x1_slc, *B_XX_ptr(),
no_trans, Q_XT_x1_slc )
492 throw std::logic_error(
493 "MatrixHessianSuperBasic::assert_initialized() : Error, "
494 "The matrix is not initialized yet" );
BLAS_Cpp::Transp B_RX_trans_
virtual void initialize(size_type n, size_type n_R, const size_type i_x_free[], const size_type i_x_fixed[], const EBounds bnd_fixed[], const B_RR_ptr_t &B_RR_ptr, const B_RX_ptr_t &B_RX_ptr, BLAS_Cpp::Transp B_RX_trans, const B_XX_ptr_t &B_XX_ptr)
Initialize the matrix.
AbstractLinAlgPack::size_type size_type
value_type transVtMtV(const SpVectorSlice &sv_rhs1, BLAS_Cpp::Transp trans_rhs2, const SpVectorSlice &sv_rhs3) const
MatrixHessianSuperBasic()
Constructs to uninitialized.
void Vt_S(VectorMutable *v_lhs, const value_type &alpha)
v_lhs *= alpha
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
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 &sv_rhs3, value_type beta) const
size_type rows(size_type rows, size_type cols, BLAS_Cpp::Transp _trans)
Return rows of a possible transposed matrix.
int resize(OrdinalType length_in)
const GenPermMatrixSlice & Q_X() const
void Mp_M_assert_sizes(size_type m_lhs_rows, size_type m_lhs_cols, BLAS_Cpp::Transp trans_lhs, size_type m_rhs_rows, size_type m_rhs_cols, BLAS_Cpp::Transp trans_rhs)
op(m_lhs) += op op(m_rhs)
const GenPermMatrixSlice & Q_R() const
value_type transVtMtV(const Vector &v_rhs1, const MatrixOp &M_rhs2, BLAS_Cpp::Transp trans_rhs2, const Vector &v_rhs3)
result = v_rhs1' * op(M_rhs2) * v_rhs3
const B_RR_ptr_t & B_RR_ptr() const
void Vp_StMtV(DVectorSlice *vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const DVectorSlice &vs_rhs2, value_type beta) const
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.
const B_XX_ptr_t & B_XX_ptr() const
const B_RX_ptr_t & B_RX_ptr() const
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)
const f_int f_dbl_prec a[]
SparseVectorSlice< SparseElement< index_type, value_type > > SpVectorSlice
Transp trans_not(Transp _trans)
Return the opposite of the transpose argument.
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)
void V_MtV(VectorMutable *v_lhs, const MatrixOp &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const V &V_rhs2)
v_lhs = op(M_rhs1) * V_rhs2.
AbstractLinAlgPack::value_type value_type
void assert_initialized() const
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
BLAS_Cpp::Transp B_RX_trans() const
void intersection(const GenPermMatrixSlice &P1, BLAS_Cpp::Transp P1_trans, const GenPermMatrixSlice &P2, BLAS_Cpp::Transp P2_trans, size_type *Q_nz, const size_type Q_max_nz=0, size_type Q_row_i[]=NULL, size_type Q_col_j[]=NULL, GenPermMatrixSlice *Q=NULL)
Find the intersection between two GenPermMatrixSlice objects.
size_type cols(size_type rows, size_type cols, BLAS_Cpp::Transp _trans)
Return columns of a possible transposed matrix.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
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)