47 #include "AbstractLinAlgPack_MatrixOpSubView.hpp"
48 #include "AbstractLinAlgPack_MultiVectorMutable.hpp"
49 #include "AbstractLinAlgPack_VectorSpace.hpp"
50 #include "AbstractLinAlgPack_VectorMutable.hpp"
51 #include "AbstractLinAlgPack_SpVectorClass.hpp"
52 #include "AbstractLinAlgPack_SpVectorView.hpp"
53 #include "AbstractLinAlgPack_EtaVector.hpp"
54 #include "AbstractLinAlgPack_LinAlgOpPack.hpp"
56 #include "Teuchos_Assert.hpp"
58 namespace AbstractLinAlgPack {
67 this->
initialize(M_full,rng_rows,rng_cols,M_trans);
77 namespace rcp = MemMngPack;
81 M_rows = M_full->rows(),
82 M_cols = M_full->cols();
84 rng_rows = RangePack::full_range(rng_rows_in,1,M_rows),
85 rng_cols = RangePack::full_range(rng_cols_in,1,M_cols);
87 rng_rows.
ubound() > M_rows, std::invalid_argument
88 ,
"MatrixOpSubView::initialize(...): Error, "
89 "rng_rows = ["<<rng_rows.
lbound()<<
","<<rng_rows.
ubound()<<
"] is of range of "
90 "[1,M_full->rows()] = [1,"<<M_rows<<
"]" );
93 ,
"MatrixOpSubView::initialize(...): Error, "
95 "[1,M_full->cols()] = [1,"<<M_cols<<
"]" );
101 ? M_full->space_cols().sub_space(rng_rows)->clone()
102 : M_full->space_rows().sub_space(
rng_cols)->clone() );
104 ? M_full->space_rows().sub_space(
rng_cols)->clone()
105 : M_full->space_cols().sub_space(rng_rows)->clone() );
108 M_full_ = Teuchos::null;
112 space_cols_ = Teuchos::null;
113 space_rows_ = Teuchos::null;
121 return ( M_full_.get()
128 return ( M_full_.get()
135 return ( M_full_.get()
136 ? ( rng_rows_.full_range() && rng_cols_.full_range()
146 assert_initialized();
152 assert_initialized();
159 assert_initialized();
161 return Teuchos::null;
166 assert_initialized();
167 if( rng_rows_.full_range() && rng_cols_.full_range() ) {
172 true, std::logic_error,
"MatrixOpSubView::zero_out(): "
173 "Error, this method can not be implemented with a sub-view" );
178 assert_initialized();
179 if( rng_rows_.full_range() && rng_cols_.full_range() ) {
180 M_full_->Mt_S(alpha);
184 true, std::logic_error,
"MatrixOpSubView::Mt_S(alpha): "
185 "Error, this method can not be implemented with a sub-view" );
190 assert_initialized();
197 assert_initialized();
209 assert_initialized();
219 assert_initialized();
229 assert_initialized();
240 assert_initialized();
242 m_lhs,alpha,P_rhs1,P_rhs1_trans,M_trans,P_rhs2,P_rhs2_trans);
250 assert_initialized();
260 assert_initialized();
270 assert_initialized();
272 alpha,P_rhs,P_rhs_trans,M_rhs,M_trans);
282 assert_initialized();
284 alpha,P_rhs1,P_rhs1_trans,M_rhs,M_trans,P_rhs2,P_rhs2_trans);
291 ,
const Vector& x, value_type b
297 assert_initialized();
304 if( rng_rows_.full_range() && rng_cols_.full_range() ) {
307 ,*M_full_, M_trans_trans
327 op_op_rng_rows = ( M_trans_trans ==
no_trans ? rng_rows_ : rng_cols_ ),
328 op_op_rng_cols = ( M_trans_trans ==
no_trans ? rng_cols_ : rng_rows_ );
330 xt = ( M_trans_trans ==
no_trans ? M_full_->space_rows() : M_full_->space_cols() ).create_member(),
331 yt = ( M_trans_trans ==
no_trans ? M_full_->space_cols() : M_full_->space_rows() ).create_member();
333 *xt->sub_view(op_op_rng_cols) = x;
334 LinAlgOpPack::V_StMtV( yt.get(), a, *M_full_, M_trans_trans, *xt );
342 assert_initialized();
350 ,
const Vector& v_rhs3, value_type beta)
const
352 assert_initialized();
354 v_lhs,alpha,P_rhs1,P_rhs1_trans,M_rhs2_trans,v_rhs3,beta);
363 assert_initialized();
365 v_lhs,alpha,P_rhs1,P_rhs1_trans,M_rhs2_trans,sv_rhs3,beta);
370 ,
const Vector& v_rhs3)
const
372 assert_initialized();
380 assert_initialized();
390 assert_initialized();
392 M_trans,alpha,P1,P1_trans,P2,P2_trans,beta,sym_lhs);
402 assert_initialized();
404 m_lhs,alpha,trans_rhs1,mwo_rhs2,trans_rhs2,beta);
413 m_lhs,alpha,mwo_rhs1,trans_rhs1,trans_rhs2,beta);
422 assert_initialized();
424 alpha,mvw_rhs1,trans_rhs1,mwo_rhs2,trans_rhs2,beta);
431 assert_initialized();
437 void MatrixOpSubView::assert_initialized()
const {
439 M_full_.get() == NULL, std::logic_error
440 ,
"Error, the MatrixOpSubView object has not been initialize!" );
virtual size_type nz() const
Return the number of nonzero elements in the matrix.
virtual vec_mut_ptr_t sub_view(const Range1D &rng)
Create a mutable abstract view of a vector object.
bool syrk(BLAS_Cpp::Transp M_trans, value_type alpha, value_type beta, MatrixSymOp *sym_lhs) const
friend void syr2k(const MatrixOp &M, BLAS_Cpp::Transp M_trans, value_type alpha, const GenPermMatrixSlice &P1, BLAS_Cpp::Transp P1_trans, const GenPermMatrixSlice &P2, BLAS_Cpp::Transp P2_trans, value_type beta, MatrixSymOp *symwo_lhs)
Abstract interface for immutable, finite dimensional, coordinate vectors {abstract}.
const VectorSpace & space_rows() const
MatrixOpSubView(const mat_ptr_t &M_full=Teuchos::null, const Range1D &rng_rows=Range1D(), const Range1D &rng_cols=Range1D(), BLAS_Cpp::Transp M_trans=BLAS_Cpp::no_trans)
Calls this->initialize(...)
void Vp_StPtMtV(VectorMutable *vs_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
void Vt_S(VectorMutable *v_lhs, const value_type &alpha)
v_lhs *= alpha
BLAS_Cpp::Transp M_trans()
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
size_type rows(size_type rows, size_type cols, BLAS_Cpp::Transp _trans)
MatrixOp::mat_ptr_t sub_view(const Range1D &row_rng, const Range1D &col_rng) const
bool Mp_StM(MatrixOp *mwo_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs) const
friend value_type transVtMtV(const Vector &v_rhs1, const MatrixOp &M_rhs2, BLAS_Cpp::Transp trans_rhs2, const Vector &v_rhs3)
friend 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 syr2k(BLAS_Cpp::Transp M_trans, value_type alpha, const GenPermMatrixSlice &P1, BLAS_Cpp::Transp P1_trans, const GenPermMatrixSlice &P2, BLAS_Cpp::Transp P2_trans, value_type beta, MatrixSymOp *symwo_lhs) const
Interface adding operations specific for a symmetric matrix {abstract}.
std::ostream & output(std::ostream &out) const
virtual std::ostream & output(std::ostream &out) const
Virtual output function.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
value_type transVtMtV(const Vector &v_rhs1, BLAS_Cpp::Transp trans_rhs2, const Vector &v_rhs3) const
Abstract interface for objects that represent a space for mutable coordinate vectors.
void initialize(const mat_ptr_t &M_full, const Range1D &rng_rows=Range1D(), const Range1D &rng_cols=Range1D(), BLAS_Cpp::Transp M_trans=BLAS_Cpp::no_trans)
Initialize the view of a matrix.
friend void Mp_StMtM(MatrixOp *mwo_lhs, value_type alpha, const MatrixOp &mwo_rhs1, BLAS_Cpp::Transp trans_rhs1, const MatrixOp &mwo_rhs2, BLAS_Cpp::Transp trans_rhs2, value_type beta)
const VectorSpace & space_cols() const
MatrixOp & operator=(const MatrixOp &M)
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)
void Mt_S(value_type alpha)
friend void Mp_StM(MatrixOp *mwo_lhs, value_type alpha, const MatrixOp &M_rhs, BLAS_Cpp::Transp trans_rhs)
Base class for all matrices that support basic matrix operations.
bool Mp_StMtP(MatrixOp *mwo_lhs, value_type alpha, BLAS_Cpp::Transp M_trans, const GenPermMatrixSlice &P_rhs, BLAS_Cpp::Transp P_rhs_trans) const
bool Mp_StPtMtP(MatrixOp *mwo_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, BLAS_Cpp::Transp M_trans, const GenPermMatrixSlice &P_rhs2, BLAS_Cpp::Transp P_rhs2_trans) const
static const Range1D Invalid
Transp trans_not(Transp _trans)
bool Mp_StPtM(MatrixOp *mwo_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs, BLAS_Cpp::Transp P_rhs_trans, BLAS_Cpp::Transp M_trans) const
friend void Mp_StMtP(MatrixOp *mwo_lhs, value_type alpha, const MatrixOp &M_rhs, BLAS_Cpp::Transp M_trans, const GenPermMatrixSlice &P_rhs, BLAS_Cpp::Transp P_rhs_trans)
Abstract interface for mutable coordinate vectors {abstract}.
bool Mp_StMtM(MatrixOp *mwo_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const MatrixOp &mwo_rhs2, BLAS_Cpp::Transp trans_rhs2, value_type beta) const
friend void syrk(const MatrixOp &mwo_rhs, BLAS_Cpp::Transp M_trans, value_type alpha, value_type beta, MatrixSymOp *sym_lhs)
friend 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)
void Vp_StMtV(VectorMutable *vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2, 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)
Concrete matrix type to represent general permutation (mapping) matrices.
friend void Mp_StPtM(MatrixOp *mwo_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs, BLAS_Cpp::Transp P_rhs_trans, const MatrixOp &M_rhs, BLAS_Cpp::Transp M_trans)
friend 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)
void Vp_V(VectorMutable *v_lhs, const V &V_rhs)
v_lhs += V_rhs.