42 #include "ConstrainedOptPack_MatrixVarReductImplicit.hpp"
43 #include "AbstractLinAlgPack_LinAlgOpPack.hpp"
44 #include "AbstractLinAlgPack_MatrixOpNonsing.hpp"
45 #include "AbstractLinAlgPack_MatrixOpOut.hpp"
46 #include "AbstractLinAlgPack_GenPermMatrixSlice.hpp"
47 #include "AbstractLinAlgPack_SpVectorClass.hpp"
48 #include "AbstractLinAlgPack_AssertOp.hpp"
49 #include "Teuchos_Workspace.hpp"
50 #include "Teuchos_Assert.hpp"
60 void imp_Vp_StMtV_implicit(
62 ,AbstractLinAlgPack::value_type a
67 ,DenseLinAlgPack::value_type b
72 namespace alap = AbstractLinAlgPack;
88 alap::VectorSpace::vec_mut_ptr_t
92 LinAlgOpPack::V_MtV( t1.get(), N,
no_trans, x );
102 alap::VectorSpace::vec_mut_ptr_t
195 namespace ConstrainedOptPack {
203 namespace rcp = MemMngPack;
206 C.
get() == NULL, std::invalid_argument
207 ,
"MatrixVarReductImplicit::initialize(...): Error, "
208 "C.get() must not be NULL" );
210 N.
get() == NULL, std::invalid_argument
211 ,
"MatrixVarReductImplicit::initialize(...): Error, "
212 "N.get() must not be NULL" );
213 if( D_direct.
get() ) {
214 const bool is_compatible_cols = D_direct->space_cols().is_compatible(C->space_cols());
216 !is_compatible_cols, VectorSpace::IncompatibleVectorSpaces
217 ,
"MatrixVarReductImplicit::initialize(...): Error, "
218 "D_direct->space_cols() is not compatible with C->space_cols()" );
219 const bool is_compatible_rows = D_direct->space_rows().is_compatible(N->space_rows());
221 !is_compatible_rows, VectorSpace::IncompatibleVectorSpaces
222 ,
"MatrixVarReductImplicit::initialize(...): Error, "
223 "D_direct->space_rows() is not compatible with N->space_rows()" );
228 D_direct_ = D_direct;
229 if(!InvCtN_rows_set_list_.empty()) {
230 for( InvCtN_rows_set_list_t::iterator itr = InvCtN_rows_set_list_.begin();
231 itr != InvCtN_rows_set_list_.end(); ++itr )
233 InvCtN_rows_[*itr] = Teuchos::null;
235 InvCtN_rows_set_list_.clear();
241 namespace rcp = MemMngPack;
244 D_direct_ = Teuchos::null;
251 return C_.get() ? C_->rows() : 0;
256 return N_.get() ? N_->cols() : 0;
263 assert_initialized();
264 return C_->space_cols();
269 assert_initialized();
270 return N_->space_rows();
275 assert_initialized();
282 o <<
"This is a " << this->
rows() <<
" x " << this->
cols()
283 <<
" variable reduction matrix D = -inv(C)*N where C and N are:\n"
290 VectorMutable* y, value_type a
292 ,
const Vector& x, value_type b
295 assert_initialized();
297 imp_Vp_StMtV_implicit( y, a, *C_, *N_, D_trans, x, b );
301 VectorMutable* y, value_type a
303 ,
const SpVectorSlice& x, value_type b
311 assert_initialized();
313 imp_Vp_StMtV_implicit( y, a, *C_, *N_, D_trans, x, b );
359 VectorMutable* y, value_type a
362 ,
const Vector& x, value_type b
367 assert_initialized();
389 VectorMutable* y, value_type a
392 ,
const SpVectorSlice& x, value_type b
397 assert_initialized();
420 void MatrixVarReductImplicit::assert_initialized()
const
423 C_.get() == NULL, std::logic_error
424 ,
"MatrixVarReductImplicit::assert_initialized(): Error, "
425 "initialize(...) has not been called yet!" );
virtual const VectorSpace & space_rows() const =0
void Vt_S(VectorMutable *v_lhs, const value_type &alpha)
virtual void initialize(const mat_nonsing_ptr_t &C, const mat_ptr_t &N, const mat_ptr_t &D_direct)
Initialize this matrix object.
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)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
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)
std::ostream & output(std::ostream &) const
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
const VectorSpace & space_cols() const
virtual size_type cols() const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void V_InvMtV(VectorMutable *v_lhs, const MatrixNonsing &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2)
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(VectorMutable *v_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2, value_type beta) const
virtual const VectorSpace & space_cols() const =0
const VectorSpace & space_rows() const
void Vp_MtV_assert_compatibility(VectorMutable *v_lhs, const MatrixOp &m_rhs1, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2)
virtual vec_mut_ptr_t create_member() const =0
virtual size_type rows() const
MatrixOp & operator=(const MatrixOp &M)
size_type cols(size_type rows, size_type cols, BLAS_Cpp::Transp _trans)
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
TEUCHOSCORE_LIB_DLL_EXPORT Teuchos::RCP< WorkspaceStore > get_default_workspace_store()
virtual void set_uninitialized()
Set the matrix to uninitialized.